In your code, how does Encode know the origin encoding? Try:
use strict; use warnings; use Encode; my $string = decode( "iso-8859-6", "أخي الزائر،" ); # see note my $encoded = join '', map { "&#$_;" } unpack 'U*', $string; print "$encoded\n"; __END__ أخٍ افز ائر�
Not sure what happens there in the last character, but the rest is consistent with your desired output. It is likely paste-related at my end, though.
Note: decode converts to utf8, and sets the utf8 flag if there are codepoints above 127. So, split // should then work on the string's characters, rather than bytes. Not sure that any of that works on perl before 5.8.
In reply to Re^5: Somthing related to encoding ??
by fishbot_v2
in thread Somthing related to encoding ??
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |