php - json_decode can't decode JSON string -


I have a string json_decode () after changing this string, there is a jizip base 64 JSON string, not decoding it can. I think this is an encoding problem, but it is unable to resolve

I am running PHP 5.2 which does not support json_last_error ().

Do anyone know what is happening here?

  & lt;? php $ gzipped_base64 = "7b0HYBxJliUmL23Ke39K9UrX4HShCIBgEyTYkEAQ7MGIzeaS7B1pRyMpqyqBymVWZV1mFkDM7Z28995777333nvvvfe6O51OJ / FF / z9cZmQBbPbOStrJniGAqsgfP358Hz8ifvGv8dGv8frXaH + N7NeY / hpvf40vf43LXyP / Nepf4 / zXKH + N6te4ou8e0f9f0e / 4tqHff8mv8f8A"; $ Json = gzinflate (base64_decode ($ gzipped_base64)); Echo $ json; // print: {"stack overflow": "rocks"} $ array = jason_decode ($ json, true); Echo var_dump ($ array); // print: tap? & Gt;    

The input is expected to be UTF-8 encoded but your data seems encoded UTF-16:

  var_export ($ json);   

Output is:

  '' '' \ "" 0 "" "" "" 0 "" "" "" 0 " '' '' '' '' '' '' '' 0 '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' L '. "\". '. "\ 0".' W '. "\ 0".' '' '\' ':'. '' '' '' '' '' '' '' '' \ 0 '' 'c' '\ ". \'. 'K'. \" \ 0 ". 'S'." \ "". Converting the character code encoding or using the  json_decode  before calling the UTF -   Change in 8.   

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -