DataTables warning: table id=tab_showHosts - JSON encoding error: Malformed UTF-8 characters, ...
DataTables warning: table id=tab_showHosts - JSON encoding error: Malformed UTF-8 characters, ...
Hi ...
Ok. I'm a strange person ... :-)
My tables have a Guid used as 'id' and I choose to pack it in a Binary(16) data field so it is easy to understand the JSON encoding error.
My question is ...
How can I convert 'on fly' the Guid packed to a string format ... well not really how ...but where can I insert that conversion??
I think there is a portion of code that has the resposability to create the JSON format from the raw data acquired from the database, is all in json() method or I have to make some changes all around??
Any idea??
Many thanks for your suggestions ...
This question has an accepted answers - jump to answer
Answers
You'd need to change the binary data to someone else in the server-side script (I don't know if you are using Python, PHP, something else). I'm sure there will be a way for whatever you are using to convert the binrary string to something readable (a decimal numbers for example).
Allan
Yes, also I am sure of this ...
I'm using PHP so I try to understand the json() method in the Editor.php class and it seems the right place to do this conversion (database data -> UI) but I have not understand where place the 'companion' part for the reverse conversion (UI -> database data) ...
Can you spend a little more time pointing me in the right direction??
Ooo - I think you are going to run into a whole lot of problems if your primary key is a binary value and you are using the Editor PHP libraries. It assumes on a fairly fundamental level that the primary key will always be a constant value from the database through to the web page and Javascript. Converting it isn't something that the libraries are set up for I'm afraid.
Can you change your primary key to be an int?
Allan