I am reading from database with some text in Hebrew and trying to json_encode
it.
if i print_r
the results i get:
Array
(
[0] => Array
(
[value] => 88
[text] => כיתה א'
[parent_id] => 1
[level] => 1
)
[1] => Array
(
[value] => 89
[text] => כיתה ב'
[parent_id] => 1
[level] => 1
)
[2] => Array
(
[value] => 91
[text] => כיתה ג'
[parent_id] => 1
[level] => 1
)
)
while the json_encode shows:
[{"value":"88","text":null,"parent_id":"1","level":"1"},{"value":"89","text":null,"parent_id":"1","level":"1"},{"value":"91","text":null,"parent_id":"1","level":"1"}]
i belive it's because my text from the database contains a ( ' ) mark. tried various combination of stripslashes or real_escape_string none have helped.
'
quote. It's most likely that your text encoding is not UTF-8. Or which charset do the database tables have? – Ephraimjson_last_error()
. php.net/json-last-error. utf8 encode your strings before calling json_encode. – Working