[Python-Dev] RE: [Patches] [ python-Patches-410465 ] Allow pre-encoded strings as filenames (original) (raw)

Mark Hammond MarkH@ActiveState.com
Mon, 14 May 2001 11:37:35 +1000


[Tim]

Mark (or anyone else who understands all this), were doc changes included? Can someone please add a briefer user-oriented blurb to Misc/NEWS too?

No problem.

Where should the "real" documentation go? It seems maybe we need a new sub-heading under the "6.1 - os -- Misc. OS Interface" - something like:

6.1.x - Unicode and the file system

Does that make sense?

I have made this change to Misc/NEWS. Does this look OK (obviously once I know what to replace "[????]" with :)

And-I-will-do-the-registry-docs-at-the-same-time ly,

Mark.

Index: NEWS

RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.166 diff -r1.166 NEWS 4a5,21

- Some operating systems now support the concept of a default Unicode encoding for file system operations. Notably, Windows supports 'mbcs' as the default. The Macintosh will also adopt this concept in the medium term, altough the default encoding for that platform will be other than 'mbcs'. On operating system that support non-ascii filenames, it is common for functions that return filenames (such as os.listdir()) to return Python string objects pre-encoded using the default file system encoding for the platform. As this encoding is likely to be different from Python's default encoding, converting this name to a Unicode object before passing it back to the Operating System would result in a Unicode error, as Python would attempt to use it's default encoding (generally ASCII) rather than the default encoding for the file system. In general, this change simply removes surprises when working with Unicode and the file system, making these operations work as you expect, increasing the transparency of Unicode objects in this context. See [????] for more details, including examples.