Skip to content

Instantly share code, notes, and snippets.

@simonseo
Created February 13, 2019 08:43
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 simonseo/cc106a968859fd3fabf00f9f0bd9146a to your computer and use it in GitHub Desktop.
Save simonseo/cc106a968859fd3fabf00f9f0bd9146a to your computer and use it in GitHub Desktop.
Converts UTF-8 characters that were encoded in ASCII compatible '\uXXXX' format to non-ASCII characters
import json, codecs
input_filename = "message.json"
output_filename = "message_new.json"
with codecs.open(input_filename, 'r', encoding='utf-8') as infile:
with codecs.open(output_filename, 'w', encoding='utf-8') as outfile:
json.dump(json.load(infile), outfile, ensure_ascii=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment