Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re^2: how to make a filename in unicode characters

by srikrishnan (Beadle)
on Jul 02, 2011 at 07:41 UTC ( #912446=note: print w/replies, xml ) Need Help??

in reply to Re: how to make a filename in unicode characters
in thread how to make a filename in unicode characters

I have tried initially as per below code

my $title = "​கோப்பு& +#8203;பெயர்"; open XXX, ">:encoding(UTF-8)", "c:/$title\.xml"; close (XXX);

Then I tried something like below

$title = encode("UTF-16LE", "​கோப&#3021 +;பு​பெயர்"); open XXX, ">:encoding(UTF-8)", "c:/$title\.xml"; close (XXX);

In the above codes I am not used hexadecimal entities, straightaway characters, here it converts those characters to hexadecimal entitites

Replies are listed 'Best First'.
Re^3: how to make a filename in unicode characters
by Corion (Pope) on Jul 02, 2011 at 07:49 UTC

    Ah - so you need to tell Perl what encoding your source code is in - if you are certain that your source code is UTF-8, the utf8 pragma might help there. You should really check the return value of open by using either autodie or doing the following:

    open ... or die "Couldn't open '$filename': $!";

    Also, you're using the backslash ("\") as filename separator - I guess that you are on Windows then. See the reply by Anonymous Monk about using Win32::Unicode then.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2018-12-13 08:24 GMT
Find Nodes?
    Voting Booth?
    How many stories does it take before you've heard them all?

    Results (62 votes). Check out past polls.