Same question that remaines unanswered although i ahve asked it in many irc channels and forum places is why the greek file name string arent UTF8 as i saved them when creating the file.
It it were then it would have benn appeared correctly in the popup menu and they wouldnt require 3 re-encodingsa back and forth from utf8 => iso-8859-7 and so on.
here is the code again:
my @files = <../data/text/*.txt>;
my @display_files = map /([^\/]+)\.txt/, @files;
Encode::from_to($_, "ISO-8859-7", "utf8") for @display_files; #1st con
+version in order to appear correctly in the popup menu
print br;
print start_form( action=>'index.pl' );
print h1( {class=>'lime'}, "Επέλεξ&#
+949; το κείμενο π&#
+959;υ σε ενδιαφέ	
+61;ει => ",
popup_menu( -name=>'select', -values=>
+\@display_files ),
submit('Εμφάν
+ιση'));
print end_form;
my $passage = param('select') || "Αρχική
+ Σελίδα!";
Encode::from_to($passage, "utf8", "ISO-8859-7") if param();
#2nd conversion in order for the user selected file from the popup men
+u to be able to be opened
if ( param('select') )
{
open(FILE, "<../data/text/$passage.txt") or die $!;
local $/;
$data = <FILE>;
close(FILE);
Encode::from_to($passage, "ISO-8859-7", "utf8");
#3nd conversion in order for the user selected file from the popup men
+u to be able to be inserted as "UTF8" in the database.
$select = $dbh->prepare( "UPDATE guestlog SET passage=?, date=?, c
+ounter=counter+1 WHERE host=?" );
$select->execute( $passage, $date, $host );
}
else more code
As you can see this re-encoding stuff its becaming very tredious and not only to this script(index.pl) but in other as well.