[Merkl, Werner wrote] > Hi, > > in my job I have a lot of differnt language to deal with, now including > japan. And we have all these languages on our server (Windows 2000)... > So NTFS uses UNICODE (I think it's 'utf-16'). > > Python -- at least since version 1.6 -- is supposed to understand > and handle UNICODE. But my experience is, it doesn't support > UNICODE for NTFS file names. > > eg: > PythonWin 2.2.1 (#34, Apr 15 2002, 09:51:39) [MSC 32 bit (Intel)] on win32. > Portions Copyright 1994-2001 Mark Hammond ([EMAIL PROTECTED]) - see >'Help/About PythonWin' for further copyright information. > >>> abc = u'a:\u03b1\u03b2\u03b3.txt'; print abc > a:???.txt > >>> open(abc,'w').write('test') > Traceback (most recent call last): > File "<interactive input>", line 1, in ? > IOError: [Errno 2] No such file or directory: 'a:a\xdf?.txt' > >>> > > Oops! Does this mean, I have to use VisualBasicScript to handle this???? > Or are there any swiches or tools or libs to use UNICODE filesystems?
I am far from the most knowledgeable about Unicode, but as far as I understand it you are right, Python is currently somehwat limited in its handling of Unicode filenames on Windows. There is a proposal to fix this in Python: Python Enhancement Proposal (PEP) 277: http://www.python.org/peps/pep-0277.html Unicode file name support for Windows NT Currently, I believe, Martin von Loewis is working on a patch for this and intends to get it to be part of Python 2.3. As a workaround you _might_ be able to work with unicode filenames by using the lower-lever Win32 API file handling calls exposed via the PyWin32 extensions. import win32file win32file.CreateFile(...) win32file.ReadFile(...) win32file.WriteFile(...) etc. Cheers, Trent -- Trent Mick [EMAIL PROTECTED] _______________________________________________ ActivePython mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython