Use json.dumps() with ensure_ascii=False
Bug #1031211 reported by
Jason Gerard DeRose
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Microfiber |
Fix Released
|
Critical
|
Jason Gerard DeRose |
Bug Description
Well, this is a bit embarrassing. Thinking that Python3 is super safe when it comes to character encodings, I haven't bothered to add any non-ascii test values yet. That was a mistake.
json.dumps() has a bad, very un-Python3-like default of ensure_ascii=True, which means you get this:
>>> json.dumps('™')
'"\\u2122"'
When you want this:
>>> json.dumps('™', ensure_ascii=False)
'"™"'
This bug is to track the fix.
Related branches
lp:~jderose/microfiber/ensure_ascii
- David Jordan: Approve
-
Diff: 135 lines (+56/-7)2 files modifiedmicrofiber.py (+7/-3)
test_microfiber.py (+49/-4)
Changed in microfiber: | |
status: | In Progress → Fix Committed |
Changed in microfiber: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.