Not quite sure the logistics behind this but attempting to print a string with Japanese characters (or anything utf-8/Unicode isn't working.
# Yes this string looks ugly, but just shows all of the things ive tried
print(str(u"銈偪銈儕")).encode('utf-8')
This throws a..
UnicodeEncodeError: `ascii` codec cant encode characters in positions 0-3: ordinal not in range
Any known fixes?
Woops..
@jakeoid I suppose you can't convert unicode to ascii without being specific in python 3 -> str(u"銈偪銈儕") - maybe close this - it isn't a bitter bug in any case.
BitBar spawns a shell without locale variables. Python 3 inherits the shell encoding and in the absence of one, it defaults to ASCII. It will attempt to encode stdout in the default encoding before emission because.... reasons. The easiest thing to do is to prepend a UTF-8 locale inside the shebang:
#!/usr/bin/env LC_ALL=en_US.UTF-8 /usr/local/bin/python3
print('銈偪銈儕')
Most helpful comment
BitBar spawns a shell without locale variables. Python 3 inherits the shell encoding and in the absence of one, it defaults to ASCII. It will attempt to encode
stdoutin the default encoding before emission because.... reasons. The easiest thing to do is to prepend a UTF-8 locale inside the shebang: