Nik has asked for the wisdom of the Perl Monks concerning the following question:
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.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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Encoding problem(reposting in more detail)
by john_oshea (Priest) on May 29, 2006 at 11:40 UTC | |
by Nik (Initiate) on May 29, 2006 at 12:40 UTC | |
by john_oshea (Priest) on May 29, 2006 at 14:45 UTC | |
|