At 11:51 am -0500 1/4/06, Sherm Pendley wrote:

On Apr 1, 2006, at 3:49 AM, kurtz le pirate wrote:

mac os x store file name in utf-8 format. so, how to open file with
"special" characters in name ?

The wanted function only gets the file name of the file, which is not enough to open the file with, if it's in a subdirectory. Try calling open() with the full path to the file, not just the file name alone.


Here's an example:

#!/usr/bin/perl
binmode STDOUT, ":utf8";
$desk = "$ENV{HOME}/desktop";
$name = "Eléments mécaniques";
$f = "$desk/$name";
open F,  ">$f" or die $!;
print F "Réussi !\n";
close F;
open F, "<:encoding(utf8)", $f;
print <F>;


JD


Reply via email to