I am totally lost on ideas.
I am using CGI::Application, HTML::Template, XML::Simple, DBI, Class::PhraseBook etc. to:
- Create an multilingual website
- The website needs to support Swedish and English
- The site uses an XML::Simple config file
The text displayed in my webpage will come from various sources such as:
- XML::Simple's XML config file
- Class::PhraseBook's XML file
- Static text from my template files
- Text in the database
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 ö
å ä ö
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.
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.