summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Gasper <felipe@felipegasper.com>2021-03-10 10:17:06 -0500
committerKarl Williamson <khw@cpan.org>2021-03-10 10:05:20 -0700
commit00b9753ba82eaf904dd10c42c409ed236921bc88 (patch)
treeb882df38d5747593803d38ccd8cef60cf987f455
parentcb174a785cca1bace5d049d08be208784028e671 (diff)
downloadperl-00b9753ba82eaf904dd10c42c409ed236921bc88.tar.gz
Fix description of what Perl does with unencoded strings.
Issue #18635
-rw-r--r--pod/perlunifaq.pod23
1 files changed, 19 insertions, 4 deletions
diff --git a/pod/perlunifaq.pod b/pod/perlunifaq.pod
index da64f43d0f..262585d478 100644
--- a/pod/perlunifaq.pod
+++ b/pod/perlunifaq.pod
@@ -63,11 +63,26 @@ positive, but it's best to avoid it.
=head2 What if I don't encode?
-Your text string will be sent using the bytes in Perl's internal format. In
-some cases, Perl will warn you that you're doing something wrong, with a
-friendly warning:
+It depends on what you output and how you output it.
- Wide character in print at example.pl line 2.
+=head3 Output via a filehandle
+
+=over
+
+=item * If the string's characters are all code point 255 or lower, Perl
+outputs bytes that match those code points. This is what happens with encoded
+strings. It can also, though, happen with unencoded strings that happen to be
+all code point 255 or lower.
+
+=item * Otherwise, Perl outputs the string encoded as UTF-8. This only happens
+with strings you neglected to encode. Since that should not happen, Perl also
+throws a "wide character" warning in this case.
+
+=back
+
+=head3 Other output mechanisms (e.g., C<exec>, C<chdir>, ..)
+
+Your text string will be sent using the bytes in Perl's internal format.
Because the internal format is often UTF-8, these bugs are hard to spot,
because UTF-8 is usually the encoding you wanted! But don't be lazy, and don't