Page 1 of 1
CKEditor cannot store unicode characters into DB
Posted: Thu Jun 13, 2024 4:33 pm
by mpol_ch
Hi
I am using the phpmaker 2024 and would like to use ckeditor to save for a text field words like "Zürich".
This is beeing saved to the mysql db as "<p>Zürich</p>"
In this case I can not export the field into PhpWord. It generates an error.
What should I do so that the word "Zürich" can be saven into database as <p>Zürich</p>...
mysql server connection collation is: utf8mb4_unicode_ci
table collation is: utf8mb3_general_ci
I added the following into config.js but it did not help.
// Set the language to Swiss German
config.language = 'de-ch';
// Enable UTF-8 support
config.defaultLanguage = 'en';
config.entities = false;
config.entities_latin = false;
config.entities_greek = false;
config.entities_processNumerical = false;
config.allowedContent = true;
config.extraAllowedContent = 'span(*)';
Any idea?
Re: CKEditor stores ö,ü not into DB
Posted: Thu Jun 13, 2024 9:55 pm
by mpol_ch
Hi,
it has been solved with the the following changes:
PhpMaker 2024--
Tool/Advanced Setting--
MySql Charset (for SET NAMES): utf8mb4
Collation for Like Operator (MySql): utf8mb4_unicode_ci
PhpMyAdmin-- SQL
ALTER DATABASE your_database_name CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
ALTER TABLE your_table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
and I have added the below code at the end of file config.js under the folder apppath/ckeditor/
// Added to save the ö,ü etc.
config.entities = true; // Converts special characters to HTML entities
config.entities_latin = false; // Disables conversion of Latin characters
config.entities_greek = false; // Disables conversion of Greek characters
config.basicEntities = false; // Disables basic entity conversion
config.entities_processNumerical = false; // Disables numerical entity conversion
config.htmlEncodeOutput = false; // Disables HTML encoding of the output
config.forceSimpleAmpersand = true; // Forces the ampersand to be output as `&`
thanks.
mpol_ch