in reply to Re^4: function length() in UTF-8 context
in thread function length() in UTF-8 context
I got constant strings which I typed in the script with accented chars UTF8-encoded.
If your source code is UTF-8, use use utf8;.
>perl -le"binmode STDOUT, ':encoding(iso-latin-1)'; print qq{print len +gth '\x85'}" | perl -l 1 Good >perl -le"binmode STDOUT, ':utf8'; print qq{print length '\x85'}" | pe +rl -l 2 BAD! >perl -le"binmode STDOUT, ':utf8'; print qq{use utf8; print length '\x +85'}" | perl -l 1 Good
|
|---|