Problem save text information about logging POST to database
Problem save text information about logging POST to database
I have a simple problem:
I use for logging information for change - postCreate, postEdit and postRemove - example:
https://editor.datatables.net/manual/php/events
function logChange ( $db, $action, $id, $values ) {
$db->insert( 'staff-log', array(
'user' => $_SESSION['username'],
'action' => $action,
'values' => json_encode( $values ),
'row' => $id,
'when' => date('c')
) );
}
It is working but:
Text values from before in input - text with UTF-8 for Czech language.
After saving to database and values has not text in UTF-8 Czech language, because in text has:
\u00e1rny p\u0159i k\u00e1vi\u010dce a lahodn\u00e9m dom\u00e1c\u00edm z\u00e1kusku. V p\u0159\u00edpad\
Thank you for solve problem.
This question has an accepted answers - jump to answer
Answers
Solving problem:
json_encode( $values, JSON_UNESCAPED_UNICODE );
Thanks for posting back. Good to hear you have it working now.
Allan
I am happy.
SOLVED !