Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: dos path accents

by Anonymous Monk
on Oct 22, 2010 at 09:19 UTC ( [id://866767]=note: print w/replies, xml ) Need Help??


in reply to Re^2: dos path accents
in thread dos path accents

FWIW, there is no need to use Win32 , its always loaded on windows. Also, since there is no need for interpolation, so you can simplify
eval { $filename = Win32::GetShortPathName( $filename ); };
On an interesting utf sidenote, As of Perl 5.8.7, UTF−8 means strict, official UTF−8 while utf8 means liberal, lax, version thereof.

Replies are listed 'Best First'.
Re^4: dos path accents
by Jim (Curate) on Oct 22, 2010 at 18:06 UTC

    Using short file names won't work on Windows NTFS file systems for which support for 8.3 file names is disabled. For performance reasons, the file servers where I work do not support 8.3 file names. See How to Disable the 8.3 Name Creation on NTFS Partitions.

    There are also times when one needs in one's Perl script the true file name with all its halfwidth katakana and right-to-left Hebrew in it. This is often my situation.

    I understand the reason why Perl's support of Unicode file names on Windows is the way it is — which is to say, lame. But I sure wish, in the interest of simple things being easy, it were not the way it is. Even in those cases, like mine, where portability isn't a factor, the often-suggested workarounds using Win32API* modules are less than ideal. And in an ever more plural world, it makes Perl seem not very Modern that it can't speak Chinese file names as easily as it can speak English ones.

        Like one of the links I posted says, use Win32::Unicode

        I addressed this already when I wrote:

        Even in those cases, like mine, where portability isn't a factor, the often-suggested workarounds using Win32API* modules are less than ideal.

        As its perldoc page says, Win32::Unicode is a "perl [sic] unicode-friendly [sic] wrapper for win32api [sic]" (i.e., a Perl Unicode-friendly wrapper for Win32API; specifically, Win32API::File).

        For me, one problem with Win32::Unicode is that I cannot easily install it on the systems at work where I need to use it. These systems are running ActivePerl 5.8.8 and there's no Win32-Unicode PPD file available for this older version of Perl in the default ActiveState repository. Is this an insurmountable impediment? Problem not, but it makes trying to use the module "less than ideal" for me. It's many more than a few mouse clicks away.

        Another problem with Win32::Unicode is its documentation: very scant and — let's be frank — in unreadable English. Ouch!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://866767]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-04-19 22:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found