in reply to Unicode File Names
In my opinion this is mostly done to be compatible with C libraries, which are console-mode based.
When not in Russian but in any other encoding, including Far East, things more complicated.
Here is how I get away of the problem using OLE interface, with elder perl:
It is quite possible for you to find another solution in Win32::xxxxxx modules.use Win32::OLE qw(in CP_UTF8); use Win32::OLE::Const; Win32::OLE->Option(CP=>CP_UTF8); use Unicode::String qw/utf8/; my $oshell = Win32::OLE->new('Shell.Application') or die "$@"; my $f = $oshell->NameSpace(Win32::GetCwd()); print "[$f]"; my $fi = $f->Items; print $fi->Count; print "\n"; for (0 .. $fi->Count-1) { my $item = $fi->Item($_); my $name = $item->Name; my $u=utf8($name); my $s = $u->hex; $s=~s/U\+00(\w\w)/my($r,$p)=((pack 'H*',$1),$&);if($r=~m(^[()\w .;\- ++!]$)){$r}else{$p}/eg; $s=~s/(U\+[\da-f][\da-f][\da-f][\da-f])/($1)/ig; my $ren=0; $ren=1 if $s=~/U\+(?!00)/; $s=~s/[ +]//g; print "$ren|$s\n"; if($ren){$item->{Name}=$s} }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Unicode File Names
by John M. Dlugosz (Monsignor) on Feb 08, 2005 at 21:48 UTC | |
by Courage (Parson) on Feb 09, 2005 at 05:30 UTC | |
by John M. Dlugosz (Monsignor) on Feb 09, 2005 at 19:31 UTC | |
by John M. Dlugosz (Monsignor) on Feb 09, 2005 at 19:52 UTC | |
by Courage (Parson) on Feb 09, 2005 at 20:23 UTC |