develooper Front page | perl.perl5.porters | Postings from April 2016

Re: [perl #122551] Term::ReadLine should work with utf-8 characters

Thread Previous | Thread Next
April 21, 2016 10:47
Re: [perl #122551] Term::ReadLine should work with utf-8 characters
Message ID:
Father Chrysostomos via RT writes:

> On Thu Sep 18 09:21:26 2014, wrote:
> > [CODE]
> > use Term::ReadLine;
> > my $term = Term::ReadLine->new('Test');
> > my $prompt = "Enter utf8 symbol: ";
> > $term->readline($prompt);
> > [/CODE]
> > 
> > Enter utf8 symbol: жузель
> > 
> > in fact, it turns out:
> > 
> > Enter utf8 symbol: ??????
> > 
> > In debian after installing the package libterm-readline-gnu-perl
> > problem is gone
> It would be useful to know which ReadLine backend it was using.  If you could uninstall the package temporarily and add:
>     warn "ReadLine library is ", $term->ReadLine;
> to your code, the output would be helpful in figuring out why the
> question marks were showing up.  (I cannot reproduce the problem on
> Mac OS X with the default Stub implementation.)

I'm not the original poster, but I can reproduce the problem on Ubuntu
with Term::ReadLine::Perl. It's fine with both the ::Stub and ::GNU back
ends.* Ostensibly, since Term::ReadLine::Perl is on Cpan, there's
nothing for P5P to do here. But ... 

Does it still make sense for Term::ReadLine (which is upstream blead)
ever to choose the ::Perl back end? If it's worse than the provided
::Stub back end, maybe ::Perl should only be chosen if explicitly

Term::ReadLine::Perl has 32 open bugs (not including this one), and its
most recent release was 2009:

Term::ReadLine (which is upstream blead) currently looks for back ends
in this order, using the first it finds: Gnu, EditLine, Perl, Stub.

If ::Perl were removed from that list, what would break? Whom would it
make things worse for?


* For what it's worth, aptitude why libterm-readline-perl-perl reveals
  that lighttpd is the reason why I have the buggy module installed.

  Anybody wanting to play along, here's the code as a one-liner:

    $ PERL_RL=Perl perl -MTerm::ReadLine -wE 'Term::ReadLine->new($0)->readline(q[Enter UTF-8 symbol: ])'

  Typing a non-Ascii character displays a � instead. However, typing
  another character then backspacing over it causes all the preceding �
  symbols to suddenly turn into their intended characters.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About