I am totally lost on ideas.
I am using CGI::Application, HTML::Template, XML::Simple, DBI, Class::PhraseBook etc. to:
The text displayed in my webpage will come from various sources such as: Example files:
XML::Simple XML config file example
<?xml version="1.0"?> <config> <language>SE</language> <login_successRM>start</login_successRM> <logoutRM>start</logoutRM> <reg_missing>åäötest</reg_missing> </config>
Class::PhraseBook XML language file example
<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE phrasebook [ <!ELEMENT phrasebook (dictionary)*> <!ELEMENT dictionary (phrase)*> <!ATTLIST dictionary name CDATA #REQUIRED> <!ELEMENT phrase (#PCDATA)> <!ATTLIST phrase name CDATA #REQUIRED> ]> <phrasebook> <dictionary name="SE"> <phrase name="1">startsida</phrase> <phrase name="2">live</phrase> <phrase name="3">musik</phrase> <phrase name="4">åäötest</phrase> </dictionary> <dictionary name="EN"> <phrase name="1">home</phrase> <phrase name="2">live</phrase> <phrase name="3">music</phrase> <phrase name="4">test</phrase> </dictionary> </phrasebook>
My problem comes with XML encoding. It encodes everything with utf-8. When I try to display my XML content from my config file and phrasebook file, the Swedish letters å, Å, ä, Ä and ö, Ö will not display correcty.
I got a suggestion that I could output everything in utf-8 by sending a header stating the charset:
$self->header_add( -type => 'text/html; charset=utf-8' );
That did the trick for my XML output, but text from the HTML::Template files and Database does not output correctly anymore. I could use the following codes for the Swedish letters å, ä and ö
&aring; &auml; &ouml;
but I can't rely that users of this webpage is going to use those codes for å, ä and ö everywhere.
What can I do? I have tried using Encode without any success.

In reply to XML encoding problem by boboson

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.