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.
Created on 2012年03月11日 16:39 by Robert.Sjöblom, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg155393 - (view) | Author: Robert Sjöblom (Robert.Sjöblom) | Date: 2012年03月11日 16:39 | |
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? |
|||
| msg155395 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2012年03月11日 16:44 | |
Probably a duplicate of issue1602. |
|||
| msg155401 - (view) | Author: Martin v. Löwis (loewis) * (Python committer) | Date: 2012年03月11日 18:18 | |
Robert: this is not a bug. Python's IO stack has the fundamental assumption that streams are byte-oriented. So the "shouldn't be the output in Unicode" is not a possible solution, since Unicode cannot work on a byte stream. As a feature request, this is indeed a duplicate of 1602. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:27 | admin | set | github: 58461 |
| 2012年03月11日 18:18:17 | loewis | set | status: open -> closed superseder: windows console doesn't print or input Unicode versions: + Python 3.3, - Python 3.2 nosy: + loewis messages: + msg155401 resolution: duplicate |
| 2012年03月11日 16:44:17 | pitrou | set | nosy:
+ pitrou messages: + msg155395 |
| 2012年03月11日 16:39:43 | Robert.Sjöblom | create | |