|From:||Steve Grazzini <steve.grazzini [...] grantstreet.com>|
|Date:||Mon, 17 Jul 2017 17:18:36 +0000|
|Subject:||"Wide character" errors are undocumented|
|To:||perlbug [...] perl.org|
perldiag has an entry for the "Wide character in %s" warning from doio.c:
Wide character in %s
(S utf8) Perl met a wide character (>255) when it wasn't expecting one. This
warning is by default on for I/O (like print). The easiest way to quiet this warning
is simply to add the ":utf8" layer to the output, e.g. "binmode STDOUT, ':utf8'".
Another way to turn off the warning is to add "no warnings 'utf8';" but that is often
closer to cheating. In general, you are supposed to explicitly mark the filehandle
with an encoding, see open and "binmode" in perlfunc.
But it doesn't describe the several fatal "Wide character" errors elsewhere:
pp_sys.c:2028: Perl_croak(aTHX_ "Wide character in %s", OP_DESC(PL_op));
sv.c:3734: Perl_croak(aTHX_ "Wide character in %s",
sv.c:3737: Perl_croak(aTHX_ "Wide character");
sv.c:8519: Perl_croak(aTHX_ "Wide character in $/");
Those should probably be documented, too. As it is, it's pretty confusing to users who
get a fatal error and try to interpret it with the description of the unrelated warning.