Created
September 17, 2018 15:51
-
-
Save djromero/362129531bf267bf0aef38e550a9bd5d to your computer and use it in GitHub Desktop.
Replace text in UTF-16 Little Endian
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!python2 | |
import sys | |
import codecs | |
name_in = sys.argv[1] | |
name_out = sys.argv[2] | |
with open(name_in, "rb") as input: | |
data = input.read() | |
data = data.decode("utf-16-le") | |
data = data.replace(u"iPhone XS Max", u"iPhone\u00A02XS\u00A02Max") # non-breaking space | |
data = data.encode("utf-16-le") | |
with open(name_out, "wb") as output: | |
output.write(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment