Skip to content

Instantly share code, notes, and snippets.

@alpiepho
Last active July 8, 2019 18:58
Show Gist options
  • Save alpiepho/37f28a50810967020d6040c7eeb13141 to your computer and use it in GitHub Desktop.
Save alpiepho/37f28a50810967020d6040c7eeb13141 to your computer and use it in GitHub Desktop.
Python - convert utf16 to utf8
import os, sys, codecs
src = ''.join(sys.argv[1:2])
dest = ''.join(sys.argv[2:3])
with open(src, 'rb') as source_file:
with open(dest, 'w+b') as dest_file:
contents = source_file.read()
dest_file.write(contents.decode('utf-16').encode('utf-8'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment