I have a Localized.strings (UTF-16) file that contains some strings that I use to generate filenames for. I open the file in python with codecs.open("Localized.strings", "r", "utf-16")
The files are created successfully but with a ‘?’ tacked onto the end of the filename, for example:
MainMenu.strings? – where the “?” is lingering from the previous encoding I assume.
I’ve tried filename_string.encode('UTF-8') and filename_string.encode('ascii') with no luck, any suggestions? Am I using these wrong?
OK, when reading lines from a file, it’s advisable to always strip() or rstrip() them. 🙂