Skip Menu |

This queue is for tickets about the Encode CPAN distribution.

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

People
Owner: Nobody in particular
Requestors: h.m.brand [...] xs4all.nl
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Documentation buglet
Date: Thu, 2 May 2013 11:26:30 +0200
To: bug-Encode [...] rt.cpan.org
From: "H.Merijn Brand" <h.m.brand [...] xs4all.nl>
--8<--- The docs on decode tell me: decode $string = decode(ENCODING, OCTETS[, CHECK]) This function returns the string that results from decoding the scalar value OCTETS, assumed to be a sequence of octets in ENCODING, into Perl's internal form. The returns the resulting string. As with encode(), ENCODING can be either a canonical name or an alias. For encoding names and aliases, see "Defining Aliases"; for CHECK, see "Handling Malformed Data". For example, to convert ISO-8859-1 data into a string in Perl's internal format: $string = decode("iso-8859-1", $octets); CAVEAT: When you run "$string = decode("utf8", $octets)", then $string might not be equal to $octets. Though both contain the same data, the UTF8 flag for $string is on unless $octets consists entirely of ASCII data on ASCII machines or EBCDIC on EBCDIC machines. See "The UTF8 flag" below. If the $string is "undef", then "undef" is returned. -->8--- The sentence "Though both contain the same data, the UTF8 flag for $string is on" is not true: $ perl -MEncode=decode -MDP \ -wE'say$Encode::VERSION;$a=decode"utf-8","x";DDump$a' 2.51 SV = PV(0x882b5a0) at 0x883fbec REFCNT = 1 FLAGS = (POK,pPOK,UTF8) PV = 0x88c4d18 "x"\0 [UTF8 "x"] CUR = 1 LEN = 12 This is perl 5, version 16, subversion 3 (v5.16.3) built for i686-linux-64int -- H.Merijn Brand http://tux.nl Perl Monger http://amsterdam.pm.org/ using perl5.00307 .. 5.17 porting perl5 on HP-UX, AIX, and openSUSE http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/ http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/
Or no longer true (which used to be true a long ago). Document fixed as follows: https://github.com/dankogai/p5-encode/commit/d60373e11568d339d999e78e90bfd10d9853a089 Dan the Maintainer Thereof On Thu May 02 05:26:48 2013, h.m.brand@xs4all.nl wrote: Show quoted text
> --8<--- The docs on decode tell me: > decode > > $string = decode(ENCODING, OCTETS[, CHECK]) > > This function returns the string that results from decoding the > scalar > value OCTETS, assumed to be a sequence of octets in ENCODING, > into > Perl's internal form. The returns the resulting string. As > with > encode(), ENCODING can be either a canonical name or an alias. > For > encoding names and aliases, see "Defining Aliases"; for CHECK, > see > "Handling Malformed Data". > > For example, to convert ISO-8859-1 data into a string in Perl's > internal format: > > $string = decode("iso-8859-1", $octets); > > CAVEAT: When you run "$string = decode("utf8", $octets)", then > $string > might not be equal to $octets. Though both contain the same > data, the > UTF8 flag for $string is on unless $octets consists entirely of > ASCII > data on ASCII machines or EBCDIC on EBCDIC machines. See "The > UTF8 > flag" below. > > If the $string is "undef", then "undef" is returned. > -->8--- > > The sentence "Though both contain the same data, the UTF8 flag for > $string is on" is not true: > > $ perl -MEncode=decode -MDP \ > -wE'say$Encode::VERSION;$a=decode"utf-8","x";DDump$a' > 2.51 > SV = PV(0x882b5a0) at 0x883fbec > REFCNT = 1 > FLAGS = (POK,pPOK,UTF8) > PV = 0x88c4d18 "x"\0 [UTF8 "x"] > CUR = 1 > LEN = 12 > > This is perl 5, version 16, subversion 3 (v5.16.3) built for i686- > linux-64int >