0

Finally got Localization and translation on cakephp 3.4 working, but when it comes to Chinese, I just hit a brick wall. I try all I could and search for more information to solve the problem but Stack is my last resort.

I have 3 languages to translate, English, French and Chanese, English and French are working like a charm. but not Chinese. I've checked my database and is UTF-8 default c. I try different internationalization codes for Chinese 'zh_CN, zh-cn, zh, zho, zho_CN, zho-cn' and none seems to be identified by cake. I even try just to add Chinese text as a primary language, it just does not work.

I have another project which has no needs translation and it does grab the Chinese text and puts it on the database no problem, once I use the I18n and I10n, it seems to create some sort of conflict to the database.

The error code I get is the following...

**Error: SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xE5\x88\xB6\xE7\xB6\x9A...' for column 'content' at row 1**

... and is telling me to check the following codes...

Please try correcting the issue for the following table aliases:

Please try correcting the issue for the following table aliases:I18n,Bookmarks_title_translation,Bookmarks_description_translation,BookmarksTags

Any help on this will be deeply appreciated.

Rod
  • 96
  • 1
  • 3
  • Thanks for your suggestion, but can you extend your comment, I don't understand how can it duplicate the string just for Chinese and not for the other 2 languages since I am using the same code for all 3 languages ? BTW, when I analyze the content of my request, there is no duplicated content on it :( thanks in advance ! – Rod Mar 29 '17 at 14:22
  • My (automatically added) comment is not ment to be an answer, it just links to a question which yours seems to be a duplicate of, ie the problem of not being able to insert multibyte strings despite using UTF-8 encoding/charsets. Follow the link and check the question and the answers. – ndm Mar 29 '17 at 14:34
  • Thanks a lot ndm for the help, your answer (link) led me into a different direction and drill down the root of the problem based on your suggestion. The devil is on the details, I solved the problem and the problem was in the database, the Table was set as UTF-8 default.c, but that specific column (field) was set with another Collation and not the Table's default or UTF-8. – Rod Mar 29 '17 at 14:49

0 Answers0