in reply to Best Way to Get Length of UTF-8 String in Bytes?
use charnames qw( :full ); use feature qw( say ); use Encode qw( encode_utf8 ); my $text = "\N{LATIN SMALL LETTER E WITH ACUTE}"; say length $text; # 1 my $utf8 = encode_utf8($text); say length $utf8; # 2
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Best Way to Get Length of UTF-8 String in Bytes?
by Jim (Curate) on Apr 24, 2011 at 01:41 UTC | |
by ikegami (Patriarch) on Apr 24, 2011 at 03:19 UTC | |
by tchrist (Pilgrim) on Apr 24, 2011 at 05:53 UTC | |
by ikegami (Patriarch) on Apr 24, 2011 at 06:00 UTC | |
by John M. Dlugosz (Monsignor) on Apr 24, 2011 at 11:29 UTC |