Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: UTF8 hash key downgraded when assigned ( use utf8; )

by beech (Parson)
on Dec 01, 2018 at 02:33 UTC ( #1226579=note: print w/replies, xml ) Need Help??

in reply to UTF8 hash key downgraded when assigned


I dont understand the problem, why are you looking at the utf flag?

It appears to be something to do with use utf8;

No UTF8 flag for \xE9, not before nor after

#!/usr/bin/perl -- use strict; use warnings; use Data::Dump qw/ dd /; use Devel::Peek qw/ Dump /; my %f = ( qq{cl\xE9}, qq{cl\xE9} ); Dump($_)for keys%f; $f{qq{cl\xE9}}=qq{cl\xE9}; $f{qq{\x{2665} \N{U+1F42A}}}=qq{\x{2665} \N{U+1F42A}}; dd\%f; dd(keys %f); Dump($_)for keys%f; __END__ SV = PV(0x3f7a8c) at 0x3f9b74 REFCNT = 2 FLAGS = (POK,FAKE,READONLY,pPOK) PV = 0x9a8ad0 "cl\351" CUR = 3 LEN = 0 { "cl\xE9" => "cl\xE9", "\x{2665} \x{1F42A}" => "\x{2665} \x{1F42A}" } ("\x{2665} \x{1F42A}", "cl\xE9") SV = PV(0xb98cc4) at 0x3f9b84 REFCNT = 2 FLAGS = (POK,FAKE,READONLY,pPOK,UTF8) PV = 0xa78390 "\342\231\245 \360\237\220\252" [UTF8 "\x{2665} \x{1f4 +2a}"] CUR = 8 LEN = 0 SV = PV(0x3f7ac4) at 0x99b9c4 REFCNT = 2 FLAGS = (POK,FAKE,READONLY,pPOK) PV = 0x9a8ad0 "cl\351" CUR = 3 LEN = 0

But doesn't like it

$ perl -le "use Data::Dump; use utf8; dd qq{}" Malformed UTF-8 character (1 byte, need 3, after start byte 0xe9) at - +e line 1. "\0" $ perl -le "use Data::Dump; dd qq{}" "\xE9"

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1226579]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2021-04-10 21:34 GMT
Find Nodes?
    Voting Booth?

    No recent polls found