CKEditor cannot store unicode characters into DB

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
mpol_ch
User
Posts: 888
Location: Switzerland

CKEditor cannot store unicode characters into DB

Post 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&uuml;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?


mpol_ch
User
Posts: 888
Location: Switzerland

Post 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


Post Reply