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

[perl #118357] Stringification doesn't preserve utf8 flag

Thread Next
From:
Jiří Pavlovský
Date:
June 6, 2013 18:26
Subject:
[perl #118357] Stringification doesn't preserve utf8 flag
Message ID:
rt-3.6.HEAD-2552-1370509330-1904.118357-75-0@perl.org
# New Ticket Created by  Jiří Pavlovský 
# Please include the string:  [perl #118357]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=118357 >



This is a bug report for perl from jiri@pavlovsky.eu,
generated with the help of perlbug 1.39 running under perl 5.16.3.


-----------------------------------------------------------------
[Please describe your issue here]

Stringification doesn't preserve utf8 flag

The following code prints:

    n is utf8 at ./test_stringify_utf8.pl line 46.
    $t->{name} is utf8 at ./test_stringify_utf8.pl line 47.
    t is not utf8 at ./test_stringify_utf8.pl line 48.


    #!/usr/bin/env perl

    use utf8;
    use Encode qw/is_utf8/;
    use strict;

    use Modern::Perl '2013';

    package Test;
    use strict;

    sub new {
        my ($class, $name) = @_;

        my $self = { name => $name };
        bless $self, $class;

        return $self;
    }

    BEGIN {
        my %OVERLOADS = (fallback => 1);

        $OVERLOADS{'""'} = 'to_string';

        use overload;
        overload->import(%OVERLOADS);
    }

    sub to_string { shift->{name} }


    package main;

    my $n = "Derviş";
    my $t = Test->new($n);

    binmode STDOUT, ":utf8";

    is_utf8($n)         ? warn "n is utf8"          : warn "n is not utf8";
    is_utf8($t->{name}) ? warn '$t->{name} is utf8' : warn '$t->{name}
is not utf8';
    is_utf8($t)         ? warn "t is utf8"          : warn "t is not utf8";



[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=library
    severity=medium
    module=overload
---
Site configuration information for perl 5.16.3:

Configured by gecko at Wed Mar 13 11:25:21 2013.

Summary of my perl5 (revision 5 version 16 subversion 3) configuration:
   
  Platform:
    osname=MSWin32, osvers=5.2, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='C:\Perl\site\bin\gcc.exe', ccflags ='-DNDEBUG -DWIN32 -D_CONSOLE
-DNO_STRICT -DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE
-DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO
-D_USE_32BIT_TIME_T -DHASATTRIBUTE -fno-strict-aliasing -mms-bitfields',
    optimize='-O2',
    cppflags='-DWIN32'
    ccversion='', gccversion='3.4.5 (mingw-vista special r3)',
gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64',
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='C:\Perl\site\bin\g++.exe', ldflags ='-L"C:\Perl\lib\CORE"'
    libpth=\lib
    libs=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32
-lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm
-lversion -lodbc32 -lodbccp32 -lcomctl32 -lmsvcrt
    perllibs=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32
-ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr
-lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 -lmsvcrt
    libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl516.lib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-mdll -L"C:\Perl\lib\CORE"'

Locally applied patches:
    ACTIVEPERL_LOCAL_PATCHES_ENTRY

---
@INC for perl 5.16.3:
    C:/Perl/site/lib
    C:/Perl/lib
    .

---
Environment for perl 5.16.3:
    HOME=Y:\
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=C:\Program Files\ActiveState Perl Dev Kit
9.2.1\bin\;C:\Perl\site\bin;C:\Perl\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program
Files\TortoiseSVN\bin;c:\perl\bin;c:\mingw\bin;c:\mingw\msys\1.0\bin;c:\Program
FIles\java\jdk1.7.0_09\bin;C:\Program
Files\GNU\GnuPG\pub;c:\msys\bin;c:\MinGW\bin;c:\msys\local\bin
    PERL_BADLANG (unset)
    SHELL (unset)


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