Thread use utf8 und Verhalten von String-Operationen (65 answers)
Opened by rosti at 2011-08-03 19:16

rosti
 2011-08-02 22:03
#150989 #150989
User since
2011-03-19
3472 Artikel
BenutzerIn
[Homepage]
user image
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)

View full thread use utf8 und Verhalten von String-Operationen