develooper Front page | perl.perl5.porters | Postings from August 2013

[perl #36248] print does not respect "use encoding 'utf8'"

Thread Previous
From:
James E Keenan via RT
Date:
August 31, 2013 01:29
Subject:
[perl #36248] print does not respect "use encoding 'utf8'"
Message ID:
rt-3.6.HEAD-1873-1377912562-1882.36248-15-0@perl.org
On Sat Jun 11 11:12:41 2005, williams@tni.com wrote:
> This is a bug report for perl from williams@tni.com,
> generated with the help of perlbug 1.35 running under perl v5.8.7.
> 
> 
> -----------------------------------------------------------------
> [Please enter your report here]
> 
> 
> #!perl
> 
> use utf8;
> use encoding 'utf8';
> use Encode;
> 
> # this simulates a utf8 string without the utf8 bit set,
> # such as one gets from DBD::mysql or LWP or etc etc.
> $x = 'hÿpër';
> Encode::_utf8_off($x);
> 
> # prints 'hÿpër' correctly
> print "$x\n";
> 
> # prints doubly-encoded utf8: 'hÿpër'
> print $x;
> print "\n";
> 
> # prints 'hÿpër' correctly
> print "$x\n";
> 
> # The point is that C< use encoding 'utf8' > did not make C< print >
> # (or the IO routines) assume utf8 instead of latin1 when it decoded
> # the string.  It only works correctly when strings are concatenated.
> # This should be regarded as a bug, IMHO.
> 
> 
> 
> [Please do not change anything below this line]
> -----------------------------------------------------------------
> ---
> Flags:
>     category=library
>     severity=medium
> ---
> Site configuration information for perl v5.8.7:
> 
> Configured by williams at Sat Jun 11 11:26:38 MDT 2005.
> 
> Summary of my perl5 (revision 5 version 8 subversion 7) configuration:
>   Platform:
>     osname=linux, osvers=2.6.9-1.681_fc3, archname=i686-linux
>     uname='linux ip137.home 2.6.9-1.681_fc3 #1 thu nov 18 15:10:10 est
> 2004 i686 i686 i386 gnulinux '
>     config_args='-de'
>     hint=recommended, useposix=true, d_sigaction=define
>     usethreads=undef use5005threads=undef useithreads=undef
> usemultiplicity=undef
>     useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
>     use64bitint=undef use64bitall=undef uselongdouble=undef
>     usemymalloc=n, bincompat5005=undef
>   Compiler:
>     cc='cc', ccflags ='-fno-strict-aliasing -pipe -I/usr/local/include
> -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
>     optimize='-O2',
>     cppflags='-fno-strict-aliasing -pipe -I/usr/local/include
> -I/usr/include/gdbm'
>     ccversion='', gccversion='3.4.2 20041017 (Red Hat 3.4.2-6.fc3)',
> gccosandvers=''
>     intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
>     d_longlong=define, longlongsize=8, d_longdbl=define,
> longdblsize=12
>     ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
> lseeksize=8
>     alignbytes=4, prototype=define
>   Linker and Libraries:
>     ld='cc', ldflags =' -L/usr/local/lib'
>     libpth=/usr/local/lib /lib /usr/lib
>     libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
>     perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
>     libc=/lib/libc-2.3.3.so, so=so, useshrplib=false,
> libperl=libperl.a
>     gnulibc_version='2.3.3'
>   Dynamic Linking:
>     dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
>     cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
> 
> Locally applied patches:
> 
> 
> ---
> @INC for perl v5.8.7:
>     /home/williams/perl-5.8.7/lib
>     /usr/local/lib/perl5/5.8.7/i686-linux
>     /usr/local/lib/perl5/5.8.7
>     /usr/local/lib/perl5/site_perl/5.8.7/i686-linux
>     /usr/local/lib/perl5/site_perl/5.8.7
>     /usr/local/lib/perl5/site_perl
>     .
> 
> ---
> Environment for perl v5.8.7:
>     HOME=/home/williams
>     LANG=en_US.UTF-8
>     LANGUAGE (unset)
>     LD_LIBRARY_PATH (unset)
>     LOGDIR (unset)
>    
PATH=/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/lib/jre/bin:/home/williams/bin:/sbin/:/usr/sbin:/usr/lib/jre/bin
>     PERLLIB=/home/williams/perl-5.8.7/lib
>     PERL_BADLANG (unset)
>     SHELL=/bin/bash
> 


On the p5p list lately I believe there has been discussion of the
problems with 'use encoding'.

Could someone familiar with those issues review this older ticket?

Thank you very much.
Jim Keenan

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=36248

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About