If I understand the discussion so far, you are putting utf8 character data into the html, but you are loading file name strings with iso-8859-7 characters into a popup menu.

So you just need to do one of the following (not both): (1) use iso-8859-7 as the text data for your html content (not utf8), and expect client browsers to use that encoding when diplaying the page; or (2) convert the file name strings to utf8 before you load them into the popup menu. Either way, the point is to make sure all the page content (text and form data) use the same encoding, and either way, Encode is the easiest to use. Here's how to convert the file names strings to utf8:

use Encode; ## add this line near the top my @files = <../data/text/*.txt>; my @display_files = map { /([^\/]+)\.txt/; decode('iso-8859-7', $1) } +@files;
In other words, just add the "decode" call to your map block; it returns the utf8 version of the 8859-7 string stored in its second arg. I don't think anything else needs to change in your code (unless you have other 8859 strings coming from other places that you haven't shown us).

In reply to Re: Encoding problems by graff
in thread Encoding problems by Nik

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.