in reply to Trying to determine the output length of a Unicode string
This post is completely wrong. Ignore.
First, you're trying to find the length of a UTF-8 string, not that of a Unicode string.
Right now, you are creating that UTF-8 string (by encoding) and printing it at the same time. To find the number its length, you need do something between those two actions. So,
needs to be changed toperl -e' binmode(STDOUT, ":encoding(UTF-8)"; $text="\x{00fc}"; say length($text); say $text; '
perl -MEncode -e' $text="\x{00fc}"; $bytes=encode("UTF-8", $text); say encode("UTF-8", length($bytes)); say $bytes; '
|
|---|