This is basically a follow-up to my node here
Parsing special chars from a XML file
Just like
jaldhar suggested I tried to use HTML::Entities to overcome my problem.
But I already stumbled into a new one. After parsing the XML file (WITH special characters in it)
I apply the HTML::Entities encode_entities to the desired strings and then save them into a HTML file using HTML::Template.
But instead of getting the right unicode codes I am getting completely different ones.
For example instead of getting (ä) & a u m l ; I get (Ã) & A t i l d e ;
I then tried the following : I made a file and put a some ä chars in there (the char not the unicode).
When I opened that file in perl and printed it to screen I saw the à char.
But when I saved the string back to the file and opened it the chars were correct again (ä)
This leads me to the idea that encode_entities translated à to & A t i l d e ; instead of ä to & a u m l ;
because the internal representation of the char somehow got broken and held à instead of ä.
Any ideas what I could do?
PS : I am on Win32
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.