Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Perl on Windows: file names with accented characters, UTF-8 and -eby dasgar (Priest) |
on May 11, 2016 at 21:20 UTC ( [id://1162808]=note: print w/replies, xml ) | Need Help?? |
I had a different Perl issue on Windows a while back and what I found that helped me might end up helping you out. In my situation, I was trying to deal with very long paths. In Windows, there are two file system APIs. One of the APIs (used by file explorer and the command prompt) is limited to a max of 250-256 characters (I've seen different reference material with differing values) and that limitation is in place for backwards compatibility. The other API allows for use of the full capabilities of NTFS, which are significantly longer path support as well as Unicode support. Although you might not be hitting the path length issue, the Unicode support may be an issue for your code. The module that I found that gave access to the second API is Win32::LongPath, which provides replacement functions that uses "Windows wide-character functions which support Unicode and extended-length paths". In your case, you would import Win32::LongPath into your code change your -e $path to be testL ('e', $path) instead. (See the documentation on the testL function for the list of other -x file tests that it can replace.) Also, if you are dealing with files that have Unicode in the filenames, you may have issues with other file related tasks, such as opening the file for reading/writing or file stat tasks. The Win32::LongPath module probably should have other functions to help provide you with a work around solution.
In Section
Seekers of Perl Wisdom
|
|