They might look the same to you, but are they?
$ perl -MData::Peek -CO -wE'$_="\xe2\x82\xac";say;DPeek$_'
€
PV("\342\202\254"\0)
$ perl -MData::Peek -CO -wE'$_="\x{20ac}";say;DPeek$_'
€
PV("\342\202\254"\0) [UTF8 "\x{20ac}"]
$ perl -MData::Peek -CO -wE'$_="€";say;DPeek$_'
€
PV("\342\202\254"\0)
$ perl -MData::Peek -Mutf8 -CO -wE'$_="€";say;DPeek$_'
€
PV("\342\202\254"\0) [UTF8 "\x{20ac}"]
$ perl -E'"\x{20ac}" eq "€" and say "EQ"'
$ perl -E'"\xe2\x82\xac" eq "€" and say "EQ"'
EQ
$ perl -Mutf8 -E'"\x{20ac}" eq "€" and say "EQ"'
EQ
$ perl -MEncode=encode -E'encode ("utf-8", "\x{20ac}") eq "€" and say "EQ"'
EQ
I suggest you use Encode's encode to guarantee valid utf-8'ness
In reply to Re: string mis-match?
by Tux
in thread string mis-match?
by zeltus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |