What's the best way to get the length of a UTF-8 string in bytes? Is there a canonical "right" way?
perldoc -f length states:
Like all Perl character operations, length() normally deals in logical characters, not physical bytes. For how many bytes a string encoded as UTF-8 would take up, use "length(Encode::encode_utf8(EXPR))" (you'll have to "use Encode" first). See Encode and perlunicode.
Is this what I want?
In reply to Best Way to Get Length of UTF-8 String in Bytes? by Jim
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |