in reply to length in bytes of utf8 string
In what sense have you made sure that stdin is actually receiving two bytes of character data (not counting the line termination)? I did it as follows:
and this gave me the correct answer (2).perl -e 'binmode( STDOUT, ":utf8" ); print "\x{00A1}\n";' | perl -e 'use utf8; binmode(STDIN,":utf8"); $x=<>; $x=~s/[\r\n+]//; use bytes; print length($x),$/;'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: length in bytes of utf8 string
by zby (Vicar) on Jun 27, 2003 at 09:03 UTC |