Search the Community
Showing results for tags 'utf8mb4'.
-
I'm importing data from the freebase.com database and having some troubles with 4 byte characters. SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF0\x9F\x92\x93\xF0\x9F...' for column 'data' at row 1 Doing some research i found out the database fields that use now utf8_general_ci collation all need to be utf8mb4_unicode_ci. But also the connection needs utf8mb4 and SET NAMES need to be utf8mb4. mysql_query("SET CHARACTER SET utf8mb4"); mysql_query("SET NAMES utf8mb4"); 1) Would ProcessWire (PDO) be able to make connection with these settings? There is a setting for this in the config but there its mentioned its depricated. Seems the PDO by default SET NAMES utf8 From the config file: /** * Optional 'set names utf8' for sites that need it (this option is deprecated) * * This may be used instead of the $config->dbCharset = 'utf8' option, and exists here only for * backwards compatibility with existing installations. Otherwise, this option is deprecated. * * $config->dbSetNamesUTF8 = true; * */ $config->dbSetNamesUTF8 = true; /** * Optional DB socket config for sites that need it (for most you should exclude this) * * $config->dbSocket = ''; * */ 2) I have ProcessWire installed, would it be possible to convert it from utf8_general_ci to utf8mb4_unicode_ci I found this in the config file that is located in the wire folder: /** * Database character set. utf8 recommended. * * Note that you should probably not add/change this on an existing site. i.e. don't add this to * an existing ProcessWire installation without asking how in the ProcessWire forums. * */ $config->dbCharset = 'utf8'; Probably need to change this to utf8mb4 then but as it mentions i should ask here, does anybody have some more information what to do to make this work? Edit: At the moment i converted the database and fields by modifying the mysql export and re-importing it again. Now it has: CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci