pep 277, Unicode filenames & mbcs encoding &c.
vincent wehren
vincent at visualtrans.de
Tue Oct 21 11:31:04 EDT 2003
"Edward K. Ream" <edreamleo at charter.net> schrieb im Newsbeitrag
news:vpagr71f8fudc7 at corp.supernews.com...
| Am I reading pep 277 correctly? On Windows NT/XP, should filenames always
| be converted to Unicode using the mbcs encoding? For example,
|
| myFile = unicode(__file__, "mbcs", "strict")
No and no. You can *still* use regular byte strings. Python will do the
conversion to Unicode for you using "mbcs" as encoding.
|
| This seems to work, and I'm wondering whether there are any other details
to
| consider.
|
| My experiments with Idle for Python 2.2 indicate that os.path.join doesn't
| work as I expect when one of the args is a Unicode string. Everything
| before the Unicode string gets thrown away. But this is probably moot:
pep
| 277 implies Python 2.3...
Exactly. Python Unicode file name support has arrived with 2.3.
|
...
|
| Are there any situations where some other encoding should be used instead
on
| Windows? What about other platforms? For instance, does Linux allow
| non-ascii file names?
You can use "os.path.supports_unicode_filenames" to check...
HTH
Vincent Wehren
If so, what encoding should be specified when
| converting to Unicode? Thanks.
Propably the default encoding, on Linux
|
| Edward
| --------------------------------------------------------------------
| Edward K. Ream email: edreamleo at charter.net
| Leo: Literate Editor with Outlines
| Leo: http://webpages.charter.net/edreamleo/front.html
| --------------------------------------------------------------------
|
|
More information about the Python-list
mailing list