Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'encoding-warnings' into expect-chars

  • Loading branch information...
commit 18c3e79a9a37e8c0480483d316c5a1383b8e4b84 2 parents 29306b7 + e2178e9
@grantm grantm authored
Showing with 14 additions and 1 deletion.
  1. +13 −0 lib/Pod/Simple.pod
  2. +1 −1  lib/Pod/Simple/TranscodeSmart.pm
View
13 lib/Pod/Simple.pod
@@ -14,6 +14,8 @@ documentation") markup language that is typically used for writing
documentation for Perl and for Perl modules. The Pod format is explained
L<perlpod>; the most common formatter is called C<perldoc>.
+Be sure to read L</ENCODING> if your Pod contains non-ASCII characters.
+
Pod formatters can use Pod::Simple to parse Pod documents and render them into
plain text, HTML, or any number of other formats. Typically, such formatters
will be subclasses of Pod::Simple, and so they will inherit its methods, like
@@ -322,6 +324,17 @@ Log an error unless C<< $parser->no_whining( TRUE ); >>.
=back
+=head1 ENCODING
+
+The Pod::Simple parser expects to read B<octets>. The parser will decode the
+octets into Perl's internal character string representation using the value of
+the C<=encoding> declaration in the POD source.
+
+If the POD source does not include an C<=encoding> declaration, the parser will
+attempt to guess the encoding (selecting one of UTF-8 or Latin-1) by examining
+the first non-ASCII bytes and applying the heuristic described in
+L<perlpodspec>.
+
=head1 CAVEATS
This is just a beta release -- there are a good number of things still
View
2  lib/Pod/Simple/TranscodeSmart.pm
@@ -32,7 +32,7 @@ sub make_transcoder {
my $x;
return sub {
foreach $x (@_) {
- $x = Encode::decode($e, $x);
+ $x = Encode::decode($e, $x) unless Encode::is_utf8($x);
}
return;
};
Please sign in to comment.
Something went wrong with that request. Please try again.