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

Re: how to make a filename in unicode characters

by ikegami (Pope)
on Jul 02, 2011 at 08:19 UTC ( #912449=note: print w/replies, xml ) Need Help??

in reply to how to make a filename in unicode characters

Perl treats file names as opaque strings of bytes. That means that file names need to be encoded as per your "locale"'s encoding (ANSI code page).

In Windows, code page 1252 is commonly used, and thus the encoding is usually cp1252.* However, cp1252 doesn't support Tamil and Hindi characters.

Windows also provides a "Unicode" aka "Wide" interface, but Perl doesn't provide access to it using builtins**. You can use Win32API::File's CreateFileW, though. IIRC, you need to still need to encode the file name yourself. If so, you'd use UTF-16le as the encoding.

Aforementioned Win32::Unicode appears to handle some of the dirty work of using Win32API::File for you. I'd also recommend starting with that.

* — The code page is returned (as a number) by the GetACP system call. Prepend "cp" to get the encoding.

** — Perl's support for Windows sucks in some respects.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (13)
As of 2016-10-24 13:46 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (306 votes). Check out past polls.