I’m unable to run a script with unicode output with the default Python build system. Some unicode characters seem to get passed over, and others result in error.
print("é")
> No output
print("⌂")
> UnicodeEncodeError: ‘charmap’ codec can’t encode character ‘\u2302’ in position 0: character maps to
The output is fine in the command line but I want them to work from ST3 in the output panel. I noticed the Python interpreter in the ST3 console can run these lines fine. I tried to apply the information from https://forum.sublimetext.com/t/solved-build-results-unicode-output/6328/3, but I don’t know what else to try except
[code]import sys
import codecs
import imp
imp.reload(sys)
enc = “utf-8” # or “cp1252”
sys.stdout = codecs.getwriter(enc)(sys.stdout, ‘replace’)
print(“é”)[/code]
I get this error message on the last line: TypeError: must be str, not bytes
In an empty program, print(sys.stdout) results in <_io.TextIOWrapper name=’’ mode=‘w’ encoding=‘cp1252’>
I don’t know if other programming languages are unable to output unicode.