Putting Unicode characters in JSON

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sat Mar 24 02:10:47 EDT 2018


On Sat, 24 Mar 2018 11:21:09 +1100, Chris Angelico wrote:

>>> If I changed my database tables to all be UTF-8 would this work
>>> cleanly without any decoding?
>>
>> Not reliably or safely. It will appear to work so long as you have only
>> pure ASCII strings from the database, and then crash when you don't:
[...]
> If the database has been configured to use UTF-8 (as mentioned, that's
> "utf8mb4" in MySQL), you won't get that byte sequence back. You'll get
> back valid UTF-8.

Of course you will -- sorry I got confused.




-- 
Steve




More information about the Python-list mailing list