On Sun, Jun 28, 2009 at 8:41 AM, André Warnier<a...@ice-sa.com> wrote: > Hi. > By curiosity, and just in case anyone knows off-hand : > > perl 5.8.8 > > In a script, I substantially do this : > > open(FIRST,'<:utf8',$name1); > open(SECOND,'>:raw',$name2); > while(defined($line = <FIRST>)) { > print SECOND $line; > } > > and I get warnings : "wide character in print to <SECOND>,.." > > I mean, I know that my data is UTF-8, and I know that some characters are > going to be "wide", and that's how I want them. > I also know that I could specify the output I/O layer as 'utf8' (which > avoids the warning). > But why do I get warnings when I specified 'raw' as the I/O layer ? > Doesn't 'raw' mean like 'as is' ?
You are decoding into characters when reading in. Perl sets the utf8 flag on $line to indicate that $line is character data. Then you are attempting to write characters (which is an abstraction) out as byte data. Perl warns you that you are doing this because the utf8 flag is set. You need to encode the character data before writing back out either by encoding explicitly or using a layer. -- Bill Moseley mose...@hank.org