perl-unicode
|
de-utf8-ing a string2007-10-17 13:57:17Hello, I need an efficient way to do this: my $buf; sub append { my $x = shift; my $new; for (my $i = 0; $i < length($x); $i++) { $new .= chr(ord(substr($x, $i, 1))); } $buf .= $new; } In practice, $buf will not have its utf8 flag set, and $x may have it set, but will not contain any characters with ordinals over 255. I'm relying on chr() to return a normal string in those cases. Any ideas? Thanks, ER
|
|