Unable to encode to iso-8859-1 encoding for some chars using Perl Encode module

Posted by ppant on Stack Overflow See other posts from Stack Overflow or by ppant
Published on 2010-06-03T05:29:31Z Indexed on 2010/06/03 5:34 UTC
Read the original article Hit count: 425

Filed under:

I have a HTML string in ISO-8859-1 encoding. I need to pass this string to HTML:Entities::decode_entities() for converting some of the HTML ASCII codes to respective chars. To so i am using a module HTML::Parser::Entities 3.65 but after decode_entities() operation my whole string changes to utf-8 string. This behavior seems fine as the documentation of the HTML::Parse. As i need this string back in ISO-8859-1 format for further processing so i have used Encode::encode("iso-8859-1",$str) to change the string back to ISO-8859-1 encoding. My results are fine excepts for some chars, a question mark is coming instead. One example is single quote ' ASCII code (’)

Can anybody help me if there any limitation of Encode module? Any other pointer will also be helpful to solve the problem.

Thanks

© Stack Overflow or respective owner

Related posts about perl