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 2011年08月24日 13:18 by r.david.murray, last changed 2022年04月11日 14:57 by admin.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| functions_print_doc.patch | zachary r., 2011年08月25日 03:13 | Add documentation to the print function detailing where it gets it's encoding information from. | review | |
| functions_print_doc_2.patch | zachary r., 2011年11月30日 03:59 | Revise patch based on code review | review | |
| print-encoding.diff | eric.araujo, 2011年11月30日 15:25 | |||
| Messages (7) | |||
|---|---|---|---|
| msg142880 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2011年08月24日 13:18 | |
A common problem encountered when using python3 is writing non-ascii to stdout. This will work fine if stdout is a terminal and the terminal encoding handles the characters, but will fail if stdout is later redirected to a pipe. The docs for sys.stdout and for print should contain or point to an explanation of why, and how to solve the problem (ie: how to set the encoding for sys.stdout/sys.stderr). Note that IMO it makes more sense for sys.stdout to default to the LOCALE encoding, but that should be a separate issue. |
|||
| msg142881 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2011年08月24日 13:21 | |
Victor says it defaults to LOCALE in 3.3. The documentation should still be expanded to mention this even in 3.3, though. |
|||
| msg142883 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2011年08月24日 13:36 | |
Ah, this was actually fixed in 3.2, so it is only 2.7 where there is the different (and long standing) problem of output of unicode to a pipe. So, the doc issue boils down to mentioning how the encoding for stdout/stderr is derived (LOCALE, overridden by PYTHONIOENCODING if set, as far as I can tell). |
|||
| msg142953 - (view) | Author: Zachary Richey (zachary r.) | Date: 2011年08月25日 03:13 | |
I'm not sure if this is good documentation, but it explains how the encoding is gotten for stdout and stderr. |
|||
| msg148497 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年11月28日 16:05 | |
Thanks for the patch. It was reviewed on our code review tool; if you did not get an email (there are glitches), follow the link on the right of your patch in the list of files. |
|||
| msg148638 - (view) | Author: Zachary Richey (zachary r.) | Date: 2011年11月30日 03:59 | |
I've reworded the patch and fixed the issues in the patch pointed out by eric.araujo. |
|||
| msg148663 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年11月30日 15:25 | |
Thanks. Here’s another take: I think the wording is better, but it’s longer. I removed the reference to sys.stdin, which you don’t print to: I haven’t checked if the doc for the input function should talk about the encoding too. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:21 | admin | set | github: 57041 |
| 2020年10月25日 22:58:27 | iritkatriel | set | type: enhancement versions: + Python 3.9, Python 3.10, - Python 2.7, Python 3.2, Python 3.3 |
| 2017年03月24日 16:29:59 | serhiy.storchaka | link | issue18713 superseder |
| 2011年11月30日 15:25:08 | eric.araujo | set | files:
+ print-encoding.diff assignee: docs@python -> eric.araujo messages: + msg148663 |
| 2011年11月30日 03:59:35 | zachary r. | set | files:
+ functions_print_doc_2.patch messages: + msg148638 |
| 2011年11月28日 16:05:03 | eric.araujo | set | nosy:
+ eric.araujo messages: + msg148497 |
| 2011年08月25日 03:13:23 | zachary r. | set | files:
+ functions_print_doc.patch nosy: + zachary r. messages: + msg142953 keywords: + patch |
| 2011年08月24日 13:36:16 | r.david.murray | set | messages: + msg142883 |
| 2011年08月24日 13:21:20 | r.david.murray | set | messages: + msg142881 |
| 2011年08月24日 13:18:13 | r.david.murray | create | |