g3lfling has asked for the wisdom of the Perl Monks concerning the following question:

Hey Monks,

Seriously hoping someone has the answer for this one.. How do I get Perl Copy to correctly pass Hebrew Characters?

I have attempted to use Encode for other languages my script will be dealing with but I have not had great success..(this will be due to my novice level skills no doubt) but I have found other work arounds by leveraging OS CP's.

Unfortunately it would appear that MS's implementation of Hebrew CP's is some what off! I know shock horror, and therefore my work around is useless with Hebrew

Sorry for the simple questions, but I'm seriously out of my depth on euro languages..

Any advice will be hugely appreciated..
Cheers and thanks

Replies are listed 'Best First'.
Re: Hebrew Characters!
by Courage (Parson) on Jun 20, 2003 at 06:58 UTC
    I will suggest you mean Hebrew characters in file names during File::Copy operations.

    In this case I could share a piece of code that deals with similar problem, it renames such files into ASCII way.

    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} }

    Courage, the Cowardly Dog
    things, I do for love to perl...

Re: Hebrew Characters!
by theorbtwo (Prior) on Jun 20, 2003 at 05:48 UTC

    You don't really give us enough information to answer your question. What problems have you had with Encode? What version of perl are you using? Can you show us what it is you're trying to accomplish -- preferably with examples or code?


    Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).