Skip Menu |
 

This queue is for tickets about the Encode CPAN distribution.

Report information
The Basics
Id: 83941
Status: resolved
Priority: 0/
Queue: Encode

People
Owner: Nobody in particular
Requestors: victor [...] vsespb.ru
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 2.42
  • 2.49
Fixed in: (no value)



Subject: Bytes treated as characters in from_to
Download (untitled) / with headers
text/plain 548b
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.
Download (untitled) / with headers
text/plain 773b
Have you read the perldoc yet? It is from_to, not to_from. swap the order and you'll get what you want; Dan the Maintainer Thereof On Thu Mar 14 08:35:15 2013, vsespb wrote: Show quoted text
> > 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.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.