kzwix has asked for the wisdom of the Perl Monks concerning the following question:
Hello again, fellow wisdom seekers.
I had opened another thread this morning, and I considered editing a second time, to add this information, but decided against it, for it is quite specific, and could be overlooked - edits are kinda stealthy, after all.
So, it would seem that the "-C" command-line option doesn't always play by the rules. Using the following program:
use utf8; use Encode; $\ = "\n"; my $unicodeScalar = "Je suis une chaîne accentuée là où il faut."; my $cmdLineArg = $ARGV[0]; my $stdInLine = <STDIN>; print '['.Encode::is_utf8($unicodeScalar).'] '.$unicodeScalar; print $unicodeScalar; print '['.Encode::is_utf8($cmdLineArg).'] '.$cmdLineArg; print '['.Encode::is_utf8($stdInLine).'] '.$stdInLine;
$ perl -CSDA t.pl `cat accents_utf8` éè [1] Je suis une cha▒ne accentu▒e l▒ o▒ il faut +. Je suis une cha▒ne accentu▒e l▒ o▒ il faut. [] éèàùôî [] éè
perl -CSDA t.pl `cat accents_utf8` éè [1] Je suis une chaîne accentuée là où il faut. Je suis une chaîne accentuée là où il faut. [1] éèà ùôî [1] éè
$ perl t.pl `cat accents_utf8` éè [1] Je suis une cha▒ne accentu▒e l▒ o▒ il faut +. Je suis une cha▒ne accentu▒e l▒ o▒ il faut. [] éèàùôî [] éè
$ perl t.pl `cat accents_utf8` éè [1] Je suis une chaîne accentuée là où il faut. Je suis une chaîne accentuée là où il faut. [] éèà ùôî [] éè
I am officially puzzled, now. I mean:
The Perl version I use is 5.10.1, could this behavior be a bug ? Or have I overlooked something major ?
EDIT: As the first comment pointed out, there was a flaw in my testing protocol. This command does what it advertises, no bug here (and, again, my thanks to McA and the other wise people who answered)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Even more puzzled than before
by McA (Priest) on Jun 20, 2014 at 16:32 UTC | |
by kzwix (Sexton) on Jun 23, 2014 at 07:45 UTC | |
|
Re: Even more puzzled than before
by RonW (Parson) on Jun 20, 2014 at 17:16 UTC | |
by kzwix (Sexton) on Jun 23, 2014 at 07:36 UTC | |
by RonW (Parson) on Jun 24, 2014 at 05:02 UTC | |
|
Re: Even more puzzled than before
by ww (Archbishop) on Jun 20, 2014 at 18:37 UTC | |
|
Re: Even more puzzled than before
by aitap (Curate) on Jun 21, 2014 at 05:47 UTC | |
by Anonymous Monk on Jun 21, 2014 at 08:50 UTC | |
|
Re: Even more puzzled than before
by Anonymous Monk on Jun 20, 2014 at 17:07 UTC |