summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-03-16 15:41:44 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-03-16 15:41:44 +0000
commit2499d3299d5b988dc734ee240003b6eb71752236 (patch)
treea0a44c4359f3fff243dec50a76958ab64585d693
parent8e2ffcbee9e186d24888a8a811664acb9d44c042 (diff)
downloadperl-2499d3299d5b988dc734ee240003b6eb71752236.tar.gz
Fix for [perl #21479] Term::ReadLine(::Stub) doesn't set UTF-8 flag.
Should work both for PERL_UNICODE/-C and use encoding 'foo'; p4raw-id: //depot/perl@18994
-rw-r--r--lib/Term/ReadLine.pm4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Term/ReadLine.pm b/lib/Term/ReadLine.pm
index 238e9fd042..a4de5fcc51 100644
--- a/lib/Term/ReadLine.pm
+++ b/lib/Term/ReadLine.pm
@@ -184,6 +184,8 @@ $DB::emacs = $DB::emacs; # To peacify -w
our @rl_term_set;
*rl_term_set = \@Term::ReadLine::TermCap::rl_term_set;
+sub PERL_UNICODE_STDIN () { 0x0001 }
+
sub ReadLine {'Term::ReadLine::Stub'}
sub readline {
my $self = shift;
@@ -196,6 +198,8 @@ sub readline {
#$str = scalar <$in>;
$str = $self->get_line;
$str =~ s/^\s*\Q$prompt\E// if ($^O eq 'MacOS');
+ utf8::upgrade($str)
+ if ${^UNICODE} & PERL_UNICODE_STDIN || defined ${^ENCODING};
print $out $rl_term_set[3];
# bug in 5.000: chomping empty string creats length -1:
chomp $str if defined $str;