utf8mb4

edited September 24 in General Support

Hi. I need to store some utf8mb4 4 bytes chinese characters (like 𤝎) and, while it is possible to insert it directly into a DB field, when I try to use the standard CA object interface I always get the error:

Incorrect string value: '\xF0\xA4\x9D\x8E' for column 'value_longtext1' at row 1

The DB has utf8mb4 charset/collation, so as the tables and columns involved.

Please, note that 3 bytes characters like 苗四九 are correctly managed and saved.

Any hint?

Thank you

Giovanni

Comments

  • The current release, like those before it, uses the standard MySQL UTF8 character encoding, which is 3-byte. The next major release, 1.8, uses utf8mb4 for newly installed systems. It also includes a shell script to convert existing databases to use utf8mb4, which I've attached here. When running it pass your MySQL user name and database name as the first and second parameters.

    Note that the changes this script makes to your database may be irreversible, so please please test this on a copy first, and make sure you have full working backups at the ready, just in case something goes awry.


    Seth

  • Can I apply it to v.1.7.8?

    or has it no effect?

  • It should work on 1.7.8 as well. As always, make sure you have full backups before you try this.

  • edited September 30

    Seth, I applied the script, but I still get the error:

    2021-09-30 11:51:48 - ERROR --> DatabaseException: Incorrect string value: '\xF0\xA4\x9D\x8E</...' for column 'value_longtext1' at row 1

    when trying to insert this character: 𤝎

    Shall I need to change any conf?

  • No, it's purely a MySQL thing. Make sure the character encoding has actually changed. Run SHOW TABLE STATUS in MySQL on your database. It'll return a list of tables with their character encodings (and lots of other information).

Sign In or Register to comment.