Conditionaly upgrade utf8 to utf8mb4 for MySQL 5.5.3#317
Conditionaly upgrade utf8 to utf8mb4 for MySQL 5.5.3#317nicolas-grekas wants to merge 6 commits intodoctrine:masterfrom nicolas-grekas:patch-1
Conversation
See http://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html As utf8mb4 is a superset of utf8, this should be transparent and backward compatible. For those really requiring the "utf8" meant by MySQL, they can use explicitely the utf8mb3 charset. But IMHO by default, Doctrine should really use utf8mb4, which is what everybody expect from a charset named "utf8".
|
See also http://dev.mysql.com/doc/refman/5.5/en/charset-unicode-upgrading.html for more detailed background. |
|
I don't think this should happen magically. Developers should do this explicitly themselves |
|
Well, what I personally think is that Doctrine should do something about utf8mb4. What exactly is the purpose of this pull request. At least the default for Doctrine should be safe for any Unicode-UTF-8 string. |
|
So, just to be consistent, I updated my patch so that both mysqli and pdomysql drivers also upgrade to utf8mb4 when possible. |
|
Sorry, but I think this is too dangerous. This is something we need to keep developers deciding on. |
|
But how can you force utf8mb4 when you create a schema? |
|
@gagarine Doctrine does not create a schema, you have to do this yourself anyways. At that point you can do it. |
|
@beberlei I used \Doctrine\DBAL\Schema\Schema(); The sql provided by "toSql' was using utf8 encoding and I don't see anyway to force utf8mb4 even if I create the Database by hand using utf8mb4. I even created the table by hand. But after inserting was not working neither. Look like the connexion encoding is not right. How can I test it? I'm very new to doctrine and perhaps is not the place to get support... any-pointer would be welcome. |
See http://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html
As utf8mb4 is a superset of utf8, this should be transparent and backward compatible.
For those really requiring the "utf8" meant by MySQL, they can use explicitely the utf8mb3 charset.
But IMHO by default, Doctrine should really use utf8mb4, which is what everybody expect from a charset named "utf8".