[Python-ideas] Introduce some obvious way to encode and decode filenames from Python code

And Clover and-dev at doxdesk.com
Tue Jul 17 01:00:32 CEST 2012


On 16/07/12 18:23, Victor Stinner wrote:
 > I wrote these functions when I worked in this topic for Python 3. Yes,
 > it would be great if you write a patch to mention these functions in
 > the doc.

Sure.

But should we be encouraging their use on Windows? I would have thought 
it the best thing to stick with the Unicode string for paths on NT, so 
that the native Win32 Unicode APIs are used instead of the 
ANSI-code-page-bound C stdio. Encoding down to the fsencoding for 
Windows just means that any path including a character that isn't in the 
ANSI CP will fail.

In lieu of some kind of abstract filepath object thatcould represent 
either bytes or str (depending on platform), how about a function that 
takes a str and only encodes it to bytes if the platform requires it?

cheers,

-- 
And Clover
mailto:and at doxdesk.com
http://www.doxdesk.com/
gtalk:chat?jid=bobince at gmail.com




More information about the Python-ideas mailing list