Unable to save japanese text in templates or content fields error occurs


unable to save japanese text in templates or content fields

Step to reproduce

I thought it was due to the database being set to latin_swedish_ci but even changing to utf8_general_ci the problem still occurs.

Observed behavior

as soon as i place any Japanese kanji (character) in my template and try to save it I get this error popping up “An error occurred while saving the template.”

I check the error log and it has this error

[2022-06-01 04:17:18] (ERROR @ /var/www/vhosts/53/105674/webspace/httpdocs/etv.efriendseigomura.com/core/src/Revolution/modTemplate.php : 94) An error occurred while saving the template.Array
[2022-06-01 04:18:56] (ERROR @ /var/www/vhosts/53/105674/webspace/httpdocs/etv.efriendseigomura.com/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 1309) Could not get table name for class: MODX\Revolution\modFormCustomizationSet
[2022-06-01 04:18:56] (ERROR @ /var/www/vhosts/53/105674/webspace/httpdocs/etv.efriendseigomura.com/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 786) MODX\Revolution\modFormCustomizationSet::getSelectColumns() is not a valid static method.
[2022-06-01 04:18:56] (ERROR @ /var/www/vhosts/53/105674/webspace/httpdocs/etv.efriendseigomura.com/core/vendor/xpdo/xpdo/src/xPDO/Om/xPDOObject.php : 227) Error 42S02 executing statement: 
    [0] => 42S02
    [1] => 1146
    [2] => Table 'db1041222_etv_v2.FCSet' doesn't exist


MODX version MODX Revolution 3.0.1-pl (traditional)
PHP Version 7.2.10

any help would be grateful.

Regards Tim

Did you change the charset in the file core/config/config.inc.php ($database_connection_charset and $database_dsn) as well?

Btw: utf8_general_ci can’t store all unicode characters. I’d use utf8mb4_general_ci instead.

thank you or your reply

checked the config file and both are set to utf8

change the database to utf8mb4_general_ci and table collation as well.

still no luck, it throws up the

An error occurred while trying to save the resource.

i run a website on modx 2 and never had this problem saving Japanese text.

any other help would be welcome.

even if i go to myphpadmin and try to input the japanese kanji into the template from there i get an error.

#1366 - Incorrect string value: ‘\xE6\x97\xA5\xE6\x9C\xAC…’ for column ‘content’ at row 1

also the database type is innoDB if that info is helpful.

could this be a php problem?

Regards Tim

In MySQL every table in a database (even every column in a table) can have its own charset.
I suspect you didn’t change the charset correctly for all the tables in the database.

1 Like

thanks for the reply.

i have checked the columns and everyone is the same.

i might try a new install to see if that has the same problem.

any other input is welcome

regards Tim

This printscreen just lists the different tables.

When you click on the table modx_site_templates and select the tab “Structure”, what is the value in the column “Collation” for the content?

Maybe also read this article from @bobray about converting the charset of a database.

thank you. in the structure tab it says they are latin1_swedish_ci

i will look into this tomorrow and report back

regards Tim

all working ok now. thank you or the help.

Regards Tim

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.