develooper Front page | perl.perl5.porters | Postings from June 2008

[perl #56336] Unexpected UTF-8 flag in ascii strings

Thread Next
From:
Alex Kapranoff
Date:
June 25, 2008 10:37
Subject:
[perl #56336] Unexpected UTF-8 flag in ascii strings
Message ID:
rt-3.6.HEAD-6656-1214392477-1706.56336-75-0@perl.org
# New Ticket Created by  Alex Kapranoff 
# Please include the string:  [perl #56336]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=56336 >



This is a bug report for perl from alex@kapranoff.ru,
generated with the help of perlbug 1.36 running under perl 5.10.0.

-----------------------------------------------------------------
[Please enter your report here]

It looks like in presence of `use utf8' barewords get the utf8 flag. 
Quoted string literals get this flag only if they contain characters 
with high codes -- in full accordance with the docs.

Example (by ikegami):
use utf8;
sub ff { print utf8::is_utf8($_[0]) ? 1 : 0, "\n"; }

ff("asd");               # 0
ff('asd');               # 0
ff(qw(asd));             # 0

ff(asd => 1);            # 1
{ no strict; ff(asd); }  # 1
ff(-asd);                # 1
ff(asd::);               # 1

PerlMonks discussion:
http://perlmonks.com/?node_id=668987

Checked in bleadperl as of today -- still the same.

The most serious result of the bug is that equal ascii strings with and 
without the flag are serialized differently. Also, utf8 flag should slow 
down hash access (barewords are frequently used as keys).

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
     category=core
     severity=medium
---
Site configuration information for perl 5.10.0:

Configured by kappa at Tue Dec 18 22:42:37 MSK 2007.

Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
   Platform:
     osname=linux, osvers=2.6.22-14-generic, 
archname=i686-linux-thread-multi-64int-ld
     uname='linux aukland 2.6.22-14-generic #1 smp sun oct 14 23:05:12 
gmt 2007 i686 gnulinux '
     config_args=''
     hint=recommended, useposix=true, d_sigaction=define
     useithreads=define, usemultiplicity=define
     useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
     use64bitint=define, use64bitall=undef, uselongdouble=define
     usemymalloc=n, bincompat5005=undef
   Compiler:
     cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing 
-pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
     optimize='-O2',
     cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe 
-I/usr/local/include'
     ccversion='', gccversion='4.1.3 20070929 (prerelease) (Ubuntu 
4.1.2-16ubuntu2)', gccosandvers=''
     intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
     d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
     ivtype='long long', ivsize=8, nvtype='long double', nvsize=12, 
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 /usr/lib64
     libs=-lnsl -lgdbm -ldl -lm -lcrypt -lutil -lpthread -lc
     perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
     libc=/lib/libc-2.6.1.so, so=so, useshrplib=false, libperl=libperl.a
     gnulibc_version='2.6.1'
   Dynamic Linking:
     dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
     cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib'

Locally applied patches:


---
@INC for perl 5.10.0:
     /site/lib
     /usr/local/lib/perl5/5.10.0/i686-linux-thread-multi-64int-ld
     /usr/local/lib/perl5/5.10.0
     /usr/local/lib/perl5/site_perl/5.10.0/i686-linux-thread-multi-64int-ld
     /usr/local/lib/perl5/site_perl/5.10.0
     .

---
Environment for perl 5.10.0:
     HOME=/home/kappa
     LANG=ru_RU.UTF-8
     LANGUAGE (unset)
     LD_LIBRARY_PATH (unset)
     LOGDIR (unset)
 
PATH=/home/kappa/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
     PERLLIB=/site/lib
     PERL_BADLANG (unset)
     SHELL=/usr/bin/zsh


Thread Next


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