Well thanks for answering i hoped i have seen you answer before but i saw it just now grff. Well finally my aproach was that:
my @files = <../data/text/*.txt>; my @display_files = map /([^\/]+)\.txt/, @files; Encode::from_to($_, "ISO-8859-7", "utf8") for @display_files; print br; print start_form( action=>'index.pl' ); print h1( {class=>'lime'}, "&#917;&#960;&#941;&#955;&#949;&#958;&# +949; &#964;&#959; &#954;&#949;&#943;&#956;&#949;&#957;&#959; &#960;&# +959;&#965; &#963;&#949; &#949;&#957;&#948;&#953;&#945;&#966;&#941;&#9 +61;&#949;&#953; => ", popup_menu( -name=>'select', -values=> +\@display_files ), submit('&#917;&#956;&#966;&#940;&#957; +&#953;&#963;&#951;')); print end_form; my $passage = param('select') || "&#913;&#961;&#967;&#953;&#954;&#942; + &#931;&#949;&#955;&#943;&#948;&#945;!"; Encode::from_to($passage, "utf8", "ISO-8859-7") if param(); if ( param('select') ) { open(FILE, "<../data/text/$passage.txt") or die $!;
Because windows are unable of saving greek filenames also in utf8 format(they save only the file contents iam afraid) i ahev to do this tediouts tranformation encodign task very often and in several instanced of my code. In the abbove example i transform grom greek => utf8 the fialen string so thay can appear correctly in the cleints browser and also then when the cleint select something uppon submit i have to *also* tranfrom back the encoded string from utf8 => greek because as you can see immediately after the user selected file must be opened. This become even more tedious when i try to also convert other greek text to utf8 othweriwse it will not appear correctly.look this for example:
print header( -charset=>'utf8' ); print start_html( -style=>'/data/css/style.css', -title=>'&#936;&#965;&#967;&#969;&#966;&#949;&#955;& +#942; &#928;&#957;&#949;&#965;&#956;&#945;&#964;&#953;&#954;&#940; &# +922;&#949;&#943;&#956;&#949;&#957;&#945;!' ); my ($select, $row, $data); my $date = strftime('%y-%m-%d %H:%M:%S', localtime); my $display_date = strftime('%a %d %b, %I:%M %p', localtime); Encode::from_to($display_date, 'ISO-8859-7', 'utf8');
#date its like this because mysql needs it to be in thsi specific outline in order to insert the date into its database date field. #as for display_date this not only needs steaming but also need encoding to utf8 form otherwise in my index.pl iam not able to see the date correctly(only the number) all other date strigns to question marks.

Today i saw that another elementt of my script needs transormation to uft8. This has become a very bery tedious and annoying work to do and i ahve to repeat thsi to other scripts as well.

I would be very gratefull if you guys find a way that i will get rid of theose tranformation and all page contect be default inputs and output as utf8.

Thank you and sorry fot the repost but i didnt got an answe to this one.

In reply to Encoding problem(conitnued) 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.