in reply to can't get å,ä and ö to work with Class::PhraseBook

Based on your updated post (thanks for the added details -- that helps), it looks like you are trying to use ISO-8859-1 in your xml data file of phrase translations, and one step or another in the process is converting these to utf8 for you. (Maybe Class::PhraseBook is doing that, I don't know.)

It might not be surprising that the conversion to utf8 is happening -- it makes things easier for multi-language text processing, in general. If you want to make sure that your final output reverts back to 8859-1, you'll probably want to use a PerlIO encoding layer on STDOUT -- like this:

binmode STDOUT, ":encoding(iso-8859-1)";
Do that before you start printing any page content. (update: and hope that some clever module doesn't reset it to ":utf8" for you later on)

Alternatively, you could just "go with the flow", have your page content written as utf8 text, and change your browser to use utf8 instead of 8859-1 -- probably no code-changes needed at all if you do it that way.

(update: when I set my browser to use utf8, the OP shows the correct character in the example that the OP says is "wrong")

Replies are listed 'Best First'.
Re^2: can't get å,ä and ö to work with Class::PhraseBook
by Anonymous Monk on Mar 13, 2006 at 09:58 UTC

    No, graff, you have the encodings the wrong way around.

    boboson, you have UTF-8 in the XML file, and it is wrongly treated as 8859-1. Ã is symptomatic for this common Unicode mess-up. You have to tell the user agent (web browser) that you deliver content in UTF-8:

    $webapp->header_add( -type => 'text/html; charset=utf-8' );

      Thanks! now I am back on track!
      I thought I was back on track, but implementing your suggestion just gave me some other problems.
      It now works with the text from the XML file, but the rest of the webpage text now looks something like this:
      Om nŠ­n av de obligatoriska uppgifterna inte visar sig st䭭a och + du inte r䴴ar till detta p¶Âppmaning fr³èoss sˆîommer ditt kon +to att raderas.
      I know I can get rid of these strange signs by using "& aring;" = å "& auml;" = ä and "& ouml;" = ö, but there must be some other way around all this? Is there a way to put codes for å, ä and ö in the XML file? or is there any other solution?