We don't bite newbies here... much | |
PerlMonks |
Re: Unicode nightmare: is there a cheat sheet or solutions diagram?by mirod (Canon) |
on Jun 10, 2010 at 13:44 UTC ( [id://844006]=note: print w/replies, xml ) | Need Help?? |
If that's any comfort, you are probably not the only one to have been tortured by Unicode for that long. I have a last-resort shell trick that goes iconv -f utf8 -t utf8 <dodgy_file> || iconv -f iso-8859-1 -t utf8 <dodgy_file> > <utf8_file> for those cases where I am not 100% sure of the encoding I get, and I don't have the time to debug it properly. In your case I wonder if the problem is not that you have some non Latin1 characters in your input (that got there through entities in the HTML maybe, something like — for example. My machine has got UTF-8 locale, so I can't reproduce exactly your problem, but the 2 one liners below give me outputs in different encodings:
That first one gives me a result in latin1.
I just added an —, an entity that cannot be printed in Latin1, to the input et voilą! Now the result is in UTF-8. In that case using HTML::Entities should help:
In Section
Seekers of Perl Wisdom
|
|