Unicode File Names

John Machin sjmachin at lexicon.net
Fri Oct 17 03:20:51 CEST 2008


On Oct 17, 11:43 am, Jordan <jordan.tayl... at gmail.com> wrote:
> I've got a bunch of files with Japanese characters in their names and
> os.listdir() replaces those characters with ?'s. I'm trying to open
> the files several steps later, and obviously Python isn't going to
> find '01-????.jpg' (formally '01-ひらがな.jpg') because it doesn't exist.
> I'm not sure where in the process I'm able to stop that from
> happening. Thanks.

The Fine Manual says:
"""
listdir( path)

Return a list containing the names of the entries in the directory.
The list is in arbitrary order. It does not include the special
entries '.' and '..' even if they are present in the directory.
Availability: Macintosh, Unix, Windows.
Changed in version 2.3: On Windows NT/2k/XP and Unix, if path is a
Unicode object, the result will be a list of Unicode objects.
"""

Are you unsure whether your version of Python is 2.3 or later?





More information about the Python-list mailing list