ph0enix has asked for the wisdom of the Perl Monks concerning the following question:

I'm using Term::ReadLine in my application for interaction with user. All program data are stored in utf-8 encoded external file and all operations should be done in unicode. I want to use binmode(STDIN, $locale_encoding) to do conversion for user input and so for output to terminal, but it seems does not work at least for input. It seems that whole input is in original encoding (iso-8859-2 in my case) instead of utf-8.

I've got error messages for all characters (not preset in iso-8859-1) when I want print readed value. Eg.

"\x{00e8}" does not map to iso-8859-2 at ../utf_test.pl line 18.

What is wrong?

Here is small piece of my code:

#!/usr/bin/perl -w # use strict; use utf8; use Term::ReadLine; my $locale_encoding = 'iso-8859-2'; binmode(STDIN, ":encoding($locale_encoding)"); binmode(STDOUT, ":encoding($locale_encoding)"); my $term = new Term::ReadLine 'test CLI', *STDIN, *STDOUT; my $prompt = "test> "; while( defined ($_ = $term->readline($prompt)) ) { if($_) { last if $_ =~ /^\s*quit/i; print $_, "\n"; } } exit 0;