[Python-bugs-list] [ python-Bugs-404539 ] os.listdir() can't grok Unicode filename
nobody
nobody@sourceforge.net
Wed, 28 Feb 2001 11:29:21 -0800
Bugs #404539, was updated on 2001-02-27 01:15
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=404539&group_id=5470
Category: Unicode
Group: Feature Request
Status: Open
Priority: 5
Submitted By: Itamar S.T.
Assigned to: Mark Hammond
Summary: os.listdir() can't grok Unicode filename
Initial Comment:
I have a file whose name is part Hebrew, part English
on my W2K VMware install. Filenames on Win2000 are
Unicode, if I'm not mistaken. I'm running BeOpen Python
2.0, with the latest Pythonwin installed.
My problem - the os.listdir() command doesn't return
the name of the file in unicode, it just replaces the
hebrew characters with question marks - '?':
>>> l = os.listdir("c:\")
>>> l[-1]
'????.txt'
>>> type(l[-1])
<type 'string'>
Perhaps the os.listdir() function could be extended
with a unicode keyword, which would tell it to return
the filenames as unicode strings?
filenames = os.listdir(path, unicode=1)
----------------------------------------------------------------------
Comment By: Tim Peters
Date: 2001-02-28 11:29
Message:
Logged In: YES
user_id=31435
Assigned to MarkH in case he has a clue. The core Python
code doesn't know about any of MS's TCHAR-related tricks
(it uses plain 8-bit C strings everywhere).
----------------------------------------------------------------------
Comment By: Fred L. Drake, Jr.
Date: 2001-02-28 11:13
Message:
Logged In: YES
user_id=3066
Tim, are you familiar with the directory searching functions under Windows? Can you determine the right thing to do?
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=404539&group_id=5470