Files with japanese filenames under Windows

Neil Hodgson nhodgson at bigpond.net.au
Mon Jan 7 17:22:37 EST 2002


Guenter Radestock:
> we found a number of problems concerning the handling of japanese
filenames
> on the Windows platform.  Can you please tell me where to find more
information
> on these issues or what I can do my self to fix some of this?

   This is currently discussion occurring on fixing this.

   For now, you may wish to use some of the other file APIs available.
win32all contains a win32file module that exposes the Win32 wide string 'W'
functions.

   win32com allows access to the FileSystemObject COM class present on
recent versions of Windows.

   All these win32* things are available from
http://users.bigpond.net.au/mhammond/win32all-142.exe

# Snippet using FileSystemObject
# FSO documentation: http://msdn.microsoft.com/scripting
# encode used here just to make things print as a quick demo
import win32com.client
fso = win32com.client.Dispatch("Scripting.FileSystemObject")
s = ""
fol = fso.GetFolder("C:\\")
for f1 in fol.Files:
 if f1.name.find(".htm") > 0:
  s += f1.Path.encode("UTF-8") + "\r\n"
  if f1.name[0] == u"z":
   fo = fso.OpenTextFile(f1.Path).ReadAll()
   s += fo.encode("UTF-8") + "\r\n"
print s

   Neil





More information about the Python-list mailing list