[Tutor] UnicodeEncodeError: 'cp932' codec can't encode character '\xe9' in position

Robert Sjoblom robert.sjoblom at gmail.com
Sun Mar 11 02:31:56 CET 2012

> You can "solve" the problem by pretending the input file is also cp932 when
> you open it. That way you'll get the wrong characters, but no errors.
So I tried that:
Traceback (most recent call last):
  File "C:\Users\Azaz\Desktop\CK2 Map Painter\Parser\test parser.py",
line 6, in <module>
    text = alpha.readlines()
UnicodeDecodeError: 'cp932' codec can't decode bytes in position
1374-1375: illegal multibyte sequence

> Or
> you can solve it by encoding the output explicitly, telling it to ignore
> errors.  I don't know how to do that in Python 3.x.
Me neither. I will research this tomorrow.

> Finally, you can change
> your console to be utf-8, and find a font that includes both sets of
> characters.
While that might be a tempting solution, it would be best if this
worked without having to do any changes to the environment itself; it
would be best if it could run on any platform, but I'll take a Windows
machine with no changes to command line if I have to.

best regards,
Robert S.

More information about the Tutor mailing list