Skip to content

Instantly share code, notes, and snippets.

@leehosung
Created January 25, 2016 09:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leehosung/36e09b25d6f9cd5f3016 to your computer and use it in GitHub Desktop.
Save leehosung/36e09b25d6f9cd5f3016 to your computer and use it in GitHub Desktop.
escape unicode of dumped data by Django
# python ./manage.py dumpdata eight.Kcb020BadCode --indent=2 | python unicode_escape.py
import sys
import codecs
decoder = codecs.getdecoder('unicode_escape')
for line in sys.stdin.readlines():
print((decoder(line))[0], end='')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment