Message155393
| 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:44 | Robert.Sjöblom | set | recipients:
+ Robert.Sjöblom, ezio.melotti |
| 2012年03月11日 16:39:44 | Robert.Sjöblom | set | messageid: <1331483984.27.0.0301545457628.issue14253@psf.upfronthosting.co.za> |
| 2012年03月11日 16:39:43 | Robert.Sjöblom | link | issue14253 messages |
| 2012年03月11日 16:39:43 | Robert.Sjöblom | create |
|