gnosek has asked for the wisdom of the Perl Monks concerning the following question:
Hello all,
I upgraded some of my systems to Perl 5.10 and have fought for several hours with a change that boils down to:
# Perl 5.8 perl -Mencoding=utf8 -le 'print ord chr 156' 156 # Perl 5.10 perl -Mencoding=utf8 -le 'print ord chr 156' 65533
I cannot easily remove the 'use encoding "utf8"' from my script as the pragma does "some magic" that prevents encoding-related disasters (double-encoded strings) further down the road.
This change means (I really hope someone will correct me) that I have to maintain my own copy of CGI::Util with "use bytes" inside "sub unescape". The offending statement is:
$todecode =~ s/%(?:([0-9a-fA-F]{2})|u([0-9a-fA-F]{4}))/ defined($1)? chr hex($1) : utf8_chr(hex($2))/ge;
Does anybody know the reason behind this change? Would that be a bug or a bugfix?
Best regards,
Grzegorz Nosek
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: "use encoding" behaviour change under Perl 5.10?
by graff (Chancellor) on Mar 21, 2009 at 16:42 UTC | |
by gnosek (Sexton) on Mar 21, 2009 at 17:54 UTC | |
by jdd (Acolyte) on Mar 21, 2009 at 19:32 UTC | |
|
Re: "use encoding" behaviour change under Perl 5.10?
by jdd (Acolyte) on Mar 21, 2009 at 13:53 UTC | |
by jdd (Acolyte) on Mar 21, 2009 at 14:13 UTC | |
by gnosek (Sexton) on Mar 21, 2009 at 15:28 UTC | |
by diotalevi (Canon) on Mar 25, 2009 at 15:37 UTC | |
|
Re: "use encoding" behaviour change under Perl 5.10?
by Anonymous Monk on Mar 22, 2009 at 05:51 UTC |