From 9d06e17cf86423ff45e4146f6ef19da13c17e60a Mon Sep 17 00:00:00 2001 From: Brian Duggan Date: Sun, 8 Nov 2026 14:40:48 -0500 Subject: [PATCH] Fix utf8 encoding of .pod files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add binmode STDOUT, ':encoding(UTF-8)'; inside pod2html, so that output is properly utf8 encoded. Currently, some UTF-8 characters in pod files are producing mojibake when rendered as HTML on Github. Example: https://github.com/Raku/old-design-docs/blob/master/S03-operators.pod X Junctive and & (&) ∩ but this should be X Junctive and & (&) ∩ I also added a test -- note this uses `=begin html` because Pod::Simple 3.48 escapes ordinary text to ASCII entities. --- lib/github/commands/pod2html | 1 + test/markups/README.utf8.pod | 13 +++++++++++++ test/markups/README.utf8.pod.html | 3 +++ 3 files changed, 17 insertions(+) create mode 100644 test/markups/README.utf8.pod create mode 100644 test/markups/README.utf8.pod.html diff --git a/lib/github/commands/pod2html b/lib/github/commands/pod2html index aaed6022..b3f0f84d 100755 --- a/lib/github/commands/pod2html +++ b/lib/github/commands/pod2html @@ -13,4 +13,5 @@ $p->strip_verbatim_indent(sub { (my $indent = $lines->[0]) =~ s/\S.*//; return $indent; }); +binmode STDOUT, ':encoding(UTF-8)'; $p->parse_from_file(shift); diff --git a/test/markups/README.utf8.pod b/test/markups/README.utf8.pod new file mode 100644 index 00000000..b2f2d186 --- /dev/null +++ b/test/markups/README.utf8.pod @@ -0,0 +1,13 @@ +=encoding utf8 + +=begin html + +

Latin-1 range: «» é

+ +=end html + +=begin html + +

Above Latin-1: ੦..੯ ٠..٩

+ +=end html diff --git a/test/markups/README.utf8.pod.html b/test/markups/README.utf8.pod.html new file mode 100644 index 00000000..8ea0e7d0 --- /dev/null +++ b/test/markups/README.utf8.pod.html @@ -0,0 +1,3 @@ +

Latin-1 range: «» é

+ +

Above Latin-1: ੦..੯ ٠..٩