[pywin32-bugs] [ pywin32-Bugs-838881 ] win32file.FindFilesW behavior with Unicode
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2003-11-09 18:49:07
|
Bugs item #838881, was opened at 2003-11-09 12:49 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=838881&group_id=78018 Category: win32 Group: None Status: Open Resolution: None Priority: 5 Submitted By: Ed Plese (eplese) Assigned to: Nobody/Anonymous (nobody) Summary: win32file.FindFilesW behavior with Unicode Initial Comment: When passing a Unicode string into win32file.FindFilesW, this string is converted to a regular string using I believe the default codepage. This is then converted back to Unicode with the win32 API function MultiByteToWideChar and then passed to the win32 API function FindFirstFileW. Doing this leads to errors like the following: File "checkfiles.py", line 14, in RecursiveDir files = win32file.FindFilesW(searchpath) UnicodeEncodeError: 'ascii' codec can't encode character '\uf1' in position 61: ordinal not in range(128) When passing in Unicode to this function, shouldn't it be preserved exactly without the unnecessary conversions? I have tried first converting the Unicode to a normal string with a number of different code pages. Sometimes that would help, but the error would appear on a different file in the directory structure that contained some other Unicode characters in the filename. The only way I could get this to work without fail was to download the source and modify this function to accept only Unicode strings, and then pass those directly to FindFirstFileW. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=838881&group_id=78018 |