in reply to Somthing related to encoding ??

The folowing will convert the entities into unicode counterpart.
$dec_text="المحتلة" $dec_text =~s/(\&\#(\d+)\;)/pack("U*",$2)/eg;

Replies are listed 'Best First'.
Re^2: Somthing related to encoding ??
by Anonymous Monk on Aug 10, 2005 at 16:12 UTC

    Thanks for your reply

    but i don't want to "pack" i want to "unpack" the word to get something like :

    المحتلة

      Sorry, for misunderstood. I had replied in a hurry.
      An alternative approach for other case.Cast these ones.
      perl -e 'my $str="czd"; my $s=join " ", map { sprintf "&#%d;", $_ } un +pack("U*",$str); print my $s;'
      or
       perl -e 'my $str="عفاريت"; my $s=join " ", map { sprintf "&#%d;", $_ } unpack("U*",$str); print my $s;'