I have the following error:
UnicodeEncodeError: 'ascii' codec can't encode character '\xd7' in position 31: ordinal not in range(128)
from this code :
test_string = """
Antelope Canyon, Arizona [1600×1068] </a>  <span class="domain">(<a
"""
print(test_string)
output of sys.getdefaultencoding :
In [6]: sys.getdefaultencoding()
Out[10]: 'utf-8'
I'm using a Chromebook with crouton - if that makes a difference (I've a feeling that it might).
I'm not sure if there's some way of 'forcing' the output of strings like this or just ignoring any chars that are problematic.
terminal or console o redirect cannot handle UTF-8; what environment are you trying to print in.
I'm trying to run this using iPython within Spacemacs
In [22]: sys.stdout.encoding
Out[27]: 'ANSI_X3.4-1968'
In the shell, what does the command locale output?
In the shell I'm running this within (iPython within Spacemacs) the command is undefined, on the default shell brought up with ctrl alt t the output is
$ locale
LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
×is the U+00D7 character.sys.stdout.encoding, which is set from the parent process (usually the shell).localeoutput?(setenv "LC_CTYPE" "UTF-8")to set a locale.