Thread use utf8 und Verhalten von String-Operationen
(65 answers)
Opened by rosti at 2011-08-03 19:16
Ahh, danke Dir!!!
Wie immer gibt es Plan B ;) Code (perl): (dl
)
1 2 3 4 my @len = unpack "U*", $c->param('text'); # CodePoint-Array my $bytes = pack "U*", @len; # Zeichen wieder aus Codepoints printf "Text: %s, Length: %u\, len2: %u, len3: %u, Substr: %s\n", $c->param('text'), length $c->param('text'), scalar @len, length $bytes, substr $bytes, 0,1; Mit 'äöü' getestet, funktioniert bei mir. Edit: Ergebnis Text: äöü, Length: 6, len2: 3, len3: 3, Substr: ä as expected ;) Last edited: 2011-08-02 22:05:21 +0200 (CEST) |