Hi,
OK, More information
1) a test script in attach. My test word is "coração"
Show quoted text> > > - output of perl -Mblib t/utf8_text.t
After that utf8 => UTF-8 change:
ambs@stravinski Term-ReadLine-Gnu-1.31 $ perl -Mblib t/utf8_text.t
1..4
# Running under perl version 5.024000 for darwin
# Current time local: Mon May 23 14:44:29 2016
# Current time GMT: Mon May 23 13:44:29 2016
# Using Test.pm version 1.28
# I'm testing Term::ReadLine::Gnu version 1.31
ok 1
#i: unix:perlio:encoding(utf8):utf8
#o: unix:perlio:encoding(utf8):utf8
ok 2
#i: unix:perlio:encoding(utf8):utf8
#o: unix:perlio:encoding(utf8):utf8
Show quoted text漢字> 漢字1
漢字1
$VAR1 = "\x{6f22}\x{5b57}1";
$VAR2 = "\x{6f22}\x{5b57}1";
ok 3
ok 4
ambs@stravinski Term-ReadLine-Gnu-1.31 $
Show quoted text> > > - output of
> > > perl -V
> > > perl Makefile.PL verbose
> > > make test TEST_VERBOSE=1
all in attach
Show quoted text> > > perl -Mblib t/00checkver.t
1..4
# Running under perl version 5.024000 for darwin
# Current time local: Mon May 23 14:47:14 2016
# Current time GMT: Mon May 23 13:47:14 2016
# Using Test.pm version 1.28
# I'm testing Term::ReadLine::Gnu version 1.31
ok 1
ok 2
ok 3
# OS: darwin
# Perl version: 5.024000
# GNU Readline Library version: 6.3, 0x603
# $TERM=xterm-256color
ok 4
Show quoted text> > > echo $TERM
xterm-256color
Show quoted text> > > - terminal emulator which you are using
iterm2
Show quoted text> > > - compiler which is used to compile the GNU Readline Library
> > > (libreadline.a) if you can know.
Apple LLVM version 7.0.0 (clang-700.1.75)
Target: x86_64-apple-darwin15.4.0
Thread model: posix
Cheers
Alberto
Message body not shown because it is not plain text.
Message body not shown because it is not plain text.
Summary of my perl5 (revision 5 version 24 subversion 0) configuration:
Platform:
osname=darwin, osvers=15.4.0, archname=darwin-2level
uname='darwin stravinski.local 15.4.0 darwin kernel version 15.4.0: fri feb 26 22:08:05 pst 2016; root:xnu-3248.40.184~3release_x86_64 x86_64 '
config_args='-Dprefix=/opt/perl'
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.11 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -DPERL_USE_SAFE_PUTENV',
optimize='-O3',
cppflags='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.11 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
ccversion='', gccversion='4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.1.75)', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678, doublekind=3
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, longdblkind=3
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -mmacosx-version-min=10.11 -fstack-protector-strong -L/usr/local/lib'
libpth=/usr/local/lib /Volumes/HDD/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.0/lib /Volumes/HDD/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib /usr/lib
libs=-lpthread -lgdbm -ldbm -ldb -ldl -lm -lutil -lc
perllibs=-lpthread -ldl -lm -lutil -lc
libc=, so=dylib, useshrplib=false, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags=' -mmacosx-version-min=10.11 -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector-strong'
Characteristics of this binary (from libperl):
Compile-time options: HAS_TIMES PERLIO_LAYERS PERL_COPY_ON_WRITE
PERL_DONT_CREATE_GVSV
PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP
PERL_PRESERVE_IVUV PERL_USE_SAFE_PUTENV
USE_64_BIT_ALL USE_64_BIT_INT USE_LARGE_FILES
USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC USE_LOCALE_TIME USE_PERLIO
USE_PERL_ATOF
Built under darwin
Compiled at May 9 2016 15:04:53
%ENV:
PERL_AUTOINSTALL_PREFER_CPAN="1"
PERL_CPANM_OPT="-S"
@INC:
/opt/perl/lib/site_perl/5.24.0/darwin-2level
/opt/perl/lib/site_perl/5.24.0
/opt/perl/lib/5.24.0/darwin-2level
/opt/perl/lib/5.24.0
.
# ABSTRACT: Simple shell to interact with PULO
use strict;
use warnings;
use URI::Encode 'uri_encode';
use Term::ReadLine;
use utf8;
use open ':encoding(utf8)';
use open ':std';
use POSIX qw(locale_h);
use locale;
BEGIN {
$ENV{LC_ALL} = "en_US.UTF-8";
my $old_locale = setlocale(LC_ALL, 'en_US.UTF-8');
}
my $term = Term::ReadLine->new("pulo-shell");
my $line = $term->readline("> ");
print {$term->OUT} "IS UTF8\n" if utf8::is_utf8($line);
print {$term->OUT} $line, "\n";
print {$term->OUT} "Encoded: ", uri_encode($line), "\n";
print {$term->OUT} "Should be: ", uri_encode("coração"), "\n";