[Vienna-pm] utf8 string als hash-key

Stefan Seifert nine at detonation.org
Mon Sep 21 01:48:30 PDT 2009


On Monday 21 September 2009 10:33:30 max wrote:
> On Sep 20, 2009, at 11:29 PM, Josef wrote:
> > Hallo, Max!
> >
> > _utf8_{on,off} setzen nur das interne Flag um!
> > Und ändern nichts an den Daten.
> 
> ja das weiss ich, das war auch genau meine absicht. ich wollt einfach
> den strings als bytes ansehen, ohne der utf8-logik

Dazu gibt es auch einen vorgesehenen Weg:

       ·   utf8::encode($string)

           Converts in-place the character sequence to the corresponding octet 
sequence in UTF-X.  The UTF8 flag is turned off, so that after
           this operation, the string is a byte string.  Returns nothing.

Danach hast du einen Byte-String mit deinen UTF-8 codierten Zeichen und Perl 
kennt sich auch aus.

Für den umgekehrten Weg vom Bytestring zu einer Perl-Zeichenkette gibts 
utf8::decode.

Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.pm.org/pipermail/vienna-pm/attachments/20090921/1267187f/attachment.bin>


More information about the Vienna-pm mailing list