JSON encoding
JSON encoding
nskwortsow
Posts: 120Questions: 0Answers: 0
Hi,
When I type "André" as a value in my editor instance, it is saved as
André
in my mySQL table (UTF-8 encoding).
Why? Which type of encoding is used by datatables?
Kind regards,
Nathan
When I type "André" as a value in my editor instance, it is saved as
André
in my mySQL table (UTF-8 encoding).
Why? Which type of encoding is used by datatables?
Kind regards,
Nathan
This discussion has been closed.
Replies
Whatever your HTML page is using. Have you got the `charset="utf-8"` attribute on the `script` tag that includes DataTables and any other scripts? Also setting the HTML encoding explicitly would be a good idea.
Allan
The data displays correctly in Editor and Datatables, but is garbled in mySQL.
E.g. André instead of André.
What do you suggest? How is data encoded by the Editor PHP classes?
There is no special handling in the PHP classes - it should just pass the data straight through.
Could you try adding the following to your PHP file (after you include the PHP bootstrap file but before you initialise the Editor class):
[code]
$db->sql("SET character_set_client=utf8");
$db->sql("SET character_set_connection=utf8");
$db->sql("SET character_set_results=utf8");
[/code]
That will force the socket connection to use UTF-8 as that sounds like it might be the weak point.
Allan