in reply to encode charset

the data files can only recognize greek characters in iso-8859-7, and not utf8, while the broswer recognize greek characters only in utf8!!!! how can i do the matching between one word that is gien by the user (through the broswer) and the data file??? i tried all the combinations that you told me, i dont have problem with the english characters, only with the greek!!

Replies are listed 'Best First'.
Re^2: encode charset
by almut (Canon) on Mar 06, 2008 at 18:54 UTC

    Tell Perl that your data files are in iso-8859-7 when you read them in (i.e. open them with "<:encoding(iso-8859-7)"), and tell Perl that your input received from the browser via CGI is in utf-8 (my $word = Encode::decode_utf8(param('word'));, or similar — in case it's not already flagged as utf8 (which is hard to tell without seeing the code) ). This results in both sides of what you want to match to be decoded into Perl character strings, which will handle wide characters correctly.

    (If you can't get it to work, please show the actual code you've tried; that makes it easier to help...)