This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Robert.Sjöblom
Recipients Robert.Sjöblom, ezio.melotti
Date 2012-03-11.16:39:43
SpamBayes Score 4.2559845e-12
Marked as misclassified No
Message-id <1331483984.27.0.0301545457628.issue14253@psf.upfronthosting.co.za>
In-reply-to
Content
I'm on a cp932-encoded system. When I read in a cp1252-file, it's read into memory properly, but when printing it, Python tries to encode the output to cp932. Here's the relevant code:

address = "C:/Path/to/file/file.ext"
with open(address, encoding="cp1252") as alpha:
  print(line, end="")

Traceback (most recent call last):
 File "C:\Python32\parser.py",
line 8, in <module>
   print(line)
UnicodeEncodeError: 'cp932' codec can't encode character '\xe9' in
position 13: illegal multibyte sequence

Shouldn't the output be in unicode?
History
Date User Action Args
2012-03-11 16:39:44Robert.Sjöblomsetrecipients: + Robert.Sjöblom, ezio.melotti
2012-03-11 16:39:44Robert.Sjöblomsetmessageid: <1331483984.27.0.0301545457628.issue14253@psf.upfronthosting.co.za>
2012-03-11 16:39:43Robert.Sjöblomlinkissue14253 messages
2012-03-11 16:39:43Robert.Sjöblomcreate