Answer the question
In order to leave comments, you need to log in
How to encode THIS in json?
Array:
Array
(
[options] => Array
(
[0] => <option [email protected]красный>@красный</option>
[1] => <option [email protected]�������>@�������</option>
[2] => <option value=��_��>��_��</option>
)
)
json_encode($array);
Malformed UTF-8 characters, possibly incorrectly encoded
serialize($array)
, there are no errors, but how to parse this string in JS into an object then?a:1:{s:7:"options";a:3:{i:0;s:54:"<option [email protected]красный>@красный</option>";i:1;s:40:"<option [email protected]�������>@�������</option>";i:2;s:34:"<option value=��_��>��_��</option>";}}
Answer the question
In order to leave comments, you need to log in
These simple strings should simply be written in plain utf-8 encoding.
Anticipating possible objections. No, not "I've been picking my nose here, and I believe that these are just strings already in utf-8 encoding", but actually be in utf-8 encoding.
Anticipating possible offers. Re-encoding - it will be gibberish. It is necessary to immediately receive in the desired encoding, from where these lines come from. Since the author suddenly decided to play the young partisan, he will look for the actual solution on his own.
After the author managed to beat out the testimony, it became possible to restore the picture of the incident.
R¤Rћ_RўRћ is UTF recoded to 1251.
Accordingly, back
echo mb_convert_encoding('ФО_ТО', "cp1251", "utf-8");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question