A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-January/019205.html below:

[Python-Dev] Unicode strings as filenames

[Python-Dev] Unicode strings as filenames [Python-Dev] Unicode strings as filenamesNeil Hodgson nhodgson@bigpond.net.au
Sun, 6 Jan 2002 12:47:43 +1100
Martin v. Loewis:

> Now that you have that change, please try to extend it to
> posixmodule.c. This is where I gave up.

   OK. os.open, os.stat, and os.listdir now work. Placed temporarily at
http://pythoncard.sourceforge.net/posixmodule.c

   os.stat is ugly because the posix_do_stat function is parameterised over
a stat function pointer but it is always _stati64 on Windows so the patch
just assumes _wstati64 is right. os.listdir returns Unicode objects rather
than strings. This makes glob.glob work as well so my earlier script that
finds the *.html files and opens them works. Unfortunately, I expect most
callers of glob() will be expecting narrow strings.

> Notice that, with changing
> Py_FileSystemDefaultEncoding and open() alone, you have worsened the
> situation: os.stat will now fail on files with non-ASCII names on
> which it works under the mbcs encoding, because windows won't find the
> file (correct me if I'm wrong).

   If you give it a file name encoded in the current code page then it may
fail where it did not before.

   Neil




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4