perl-unicode

5.8.8 vs. 5.10: encoding.pm vs utf8.pm

2009-03-21 19:59:49

I'm wondering if anyone on this list can help with answering the 
question(s) raised in the following thread at perlmonks:

http://www.perlmonks.org/?node_id=752220

The basic issue is the difference between 5.8 and 5.10 with regard to 
this one-liner:

 perl -Mencoding=utf8 -le 'printf "%x\n", ord(chr(193))'

On 5.8.8 (encoding.pm v2.02, utf8.pm v1.06), that produces "c1" (hex for 
193.)

On 5.10.0 (encoding.pm v2.06, utf8.pm v1.07), it produces "fffd" (unicode 
replacement character.)

I'm assuming it has to do with how utf8::upgrade works in the context of 
"use encoding qw/utf8/", but I couldn't see any real code difference when 
comparing the two versions of utf8.pm, and likewise for the two versions 
of encoding.pm.

So (just curious), what caused the change, and was it intentional?  
Perhaps the docs for encoding.pm should clarify whether it makes (no) 
sense to have "use encoding 'utf8';" in one's perl script?

Thanks,
        David Graff

<Prev in Thread] Current Thread [Next in Thread>