Title: os.listdir documentation should mention surrogateescape
Type: Stage: needs patch
Components: Documentation Versions: Python 3.3
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, eric.araujo, loewis, michael.foord, misdre, vstinner
Priority: normal Keywords: patch

Created on 2011-12-09 01:49 by michael.foord, last changed 2012-01-02 17:16 by eric.araujo.

File name Uploaded Description Edit
listdir-pep383.patch misdre, 2011-12-17 18:07 mention surrogateescape and pep 383 review
Messages (4)
msg149070 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2011-12-09 01:49
Where os.listdir encounters undecodable bytes from the filesystem it uses the surrogateescape handler. As the resulting strings are invalid they can't be encoded without an errorhandler, and so can't be printed (for example).

This should be documented.
msg149264 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-12-12 01:09
Can you please write a doc patch?
msg149686 - (view) Author: (misdre) Date: 2011-12-17 18:07
Added a small patch to mention surrogateescape and PEP 383.
msg150466 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-01-02 17:16
Patch looks good, apart from a missing “the”, but I think it should be expanded: Right now it tells that surrogateescape is used, but IMO it would be more useful if it also mentioned practical implications, i.e. what Michael “The Beard” Foord says in the first message.
Date User Action Args
2012-01-02 17:16:48eric.araujosetmessages: + msg150466
2011-12-17 18:07:25misdresetfiles: + listdir-pep383.patch

nosy: + misdre
messages: + msg149686

keywords: + patch
2011-12-12 01:09:03vstinnersetmessages: + msg149264
2011-12-10 16:34:00eric.araujosetnosy: + loewis, vstinner, eric.araujo
2011-12-09 01:49:59michael.foordcreate