Subject: | Bytes treated as characters in from_to |
use Devel::Peek;
use Encode qw/from_to/;
my $x = "\321\202\320\265\321\201\321\202";
Dump $x;
from_to($x, "UTF-8", "ISO-8859-1", Encode::DIE_ON_ERR|Encode::LEAVE_SRC);
__END__
prints:
SV = PV(0x20f1b78) at 0x211cae0
REFCNT = 1
FLAGS = (PADMY,POK,pPOK)
PV = 0x210fd80 "\321\202\320\265\321\201\321\202"\0
CUR = 8
LEN = 16
"\x{0442}" does not map to iso-8859-1 at
/usr/local/lib/perl/5.10.1/Encode.pm line 197.
Well, I think any octet could be mapped to iso-8859-1. And from_to
should treat input as byte string, not character string.