Search code examples
pythonjsonsimplejson

Json unicode decoding in python's simplejson


I can't decode json strings like this: "\u0e4f\u0361\u032f\u0e4f"

>>> import simplejson
>>> simplejson.loads('"\u0e4f\u0361\u032f\u0e4f"', encoding='utf8')
u'\u0e4f\u0361\u032f\u0e4f'

However php json_decode works fine:

json_decode('"\u0e4f\u0361\u032f\u0e4f"');

What am I doing wrong?


Solution

  • Nothing. The Python REPL prints the repr() of the string, not the string itself.

    >>> print u'\u0e4f\u0361\u032f\u0e4f'
    ๏̯͡๏