Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Files with arabic names

by 1nickt (Canon)
on Jul 13, 2017 at 18:44 UTC ( #1195066=note: print w/replies, xml ) Need Help??


in reply to Files with arabic names

Same way as any other file, with unlink. Your computer doesn't care what language the filename is in.

$ perl -Mstrict -MPath::Tiny -wE '
my $filename = "شاب مراد كالعادة يصرع";
path( $filename )->spew("Hello, world");
say qx{cat "$filename"};
unlink $filename;
say qx{ls "$filename"};
'
Hello, world
ls: شاب مراد كالعادة يصرع: No such file or directory

Perhaps you meant something else? Maybe you need to learn about character encoding? See for example perlunitut, or this node.


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^2: Files with arabic names
by Corion (Patriarch) on Jul 13, 2017 at 18:52 UTC

    This is only true if the character encoding used is the same between Perl and the other process(es) showing the files.

    On Unixish systems, filenames are opaque blobs of octets and all interpretation of them as UTF-8 octets is solely by convention.

    On Windows systems, filenames are encoded as wide characters (UTF-16) and you have to use the Wide APIs to access/delete them. If your filenames are encoded as UTF-8, you have to change their encoding to UTF-16 when talking to the Windows API.

    Win32::Unicode helps there.

      Well, the OP was rather vague about where the filenames were, and his real issue is character encoding, not deleting files, don't you think? That's what I was attempting to point out.


      The way forward always starts with a minimal test.
      A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2022-06-27 12:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My most frequent journeys are powered by:









    Results (88 votes). Check out past polls.

    Notices?