Marc-Andre Lemburg <m...@egenix.com> added the comment: STINNER Victor wrote: > > STINNER Victor <victor.stin...@haypocalc.com> added the comment: > >> Please follow the naming convention used in os.path. The functions >> would have to be called os.path.fsencode() and os.path.fsdecode(). > > Ok > >> Other than that, I'm +0 on the patch: the sys.filesystemencoding >> logic doesn't really work well in practice - on Unix and BSD >> platforms, there's no such thing as a single system-wide file >> system > > Today, most POSIX system uses utf8 by default for all partitions. If you > mount an USB key, CD-Rom or network shared directory with the wrong options, > you may get filenames in a different encoding. But this issue is not about > fixing your OS configuration, but helping the most common case: a system > using the same encoding everywhere (for the whole file system). > > You are still free to use directly the native OS type (unicode on Windows, > bytes on other OS), ie. don't use fsencode()/fsdecode().
Right, but if you start using those new API in standard lib functions, programmers no longer have that choice. In real life applications, you do run into these problems quite often, so instead of coding against an ideal world, we have to be aware of the problems and make it possible for the standard lib modules to deal with them. > Python3 prefers unicode, eg. print expects an unicode string, not a byte > string. I mean it's more pratical to use unicode everywhere in Python, and so > fsencode()/fsdecode() can be really useful on POSIX systems. Sure, but forcing UnicodeDecodeErrors upon Python3 programmers is not a good idea. Please keep that in mind. Thanks, -- Marc-Andre Lemburg eGenix.com ________________________________________________________________________ ::: Try our new mxODBC.Connect Python Database Interface for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/ ---------- title: Create fsencode() and fsdecode() functions in os.path -> Create fs_encode() and fs_decode() functions in os.path _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8514> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com