Perl-Sensitive Sunglasses | |
PerlMonks |
Re: converting smart quotesby tobyink (Canon) |
on Mar 19, 2012 at 22:26 UTC ( [id://960485]=note: print w/replies, xml ) | Need Help?? |
You have a utf8-encoded string. You need to convert it to Perl's native Unicode string format (which also happens to be utf8-encoded internallly, but marked with a special flag such that multibyte sequences are treated as single characters). You can do this like:
The utf8::decode function works in-place (like chomp), so you can just call it in a void context. That said, you won't find a \x92 character on the page you linked to, because there is none. There's a \x{2019} character though.
The following takes the page content, and makes ASCII control characters and non-ASCII characters visible.
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
In Section
Seekers of Perl Wisdom
|
|