summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Allbery <rra@cpan.org>2022-01-18 22:41:57 -0800
committerRuss Allbery <rra@cpan.org>2022-01-18 22:41:57 -0800
commitbccbaa9e9fcd19606281c2494148f801cd803653 (patch)
tree4f9f04b8373740bbff8a9bed59b7b171589d82b9
parent0a89695fb71cc15bd34b82a9ed7f59d804153293 (diff)
Fix Unicode handling from pointers
Correctly handle Unicode output from commands run by pointers and from POD processing by Pod::Thread. Previous versions since 6.01 were double-encoding. Thanks to Julien ÉLIE for the report.
-rw-r--r--Changes4
-rw-r--r--lib/App/DocKnot/Spin.pm5
-rw-r--r--lib/App/DocKnot/Spin/Pointer.pm1
3 files changed, 10 insertions, 0 deletions
diff --git a/Changes b/Changes
index 6cf64cd..fc67608 100644
--- a/Changes
+++ b/Changes
@@ -2,6 +2,10 @@
7.01 - Not Released
+ - Correctly handle Unicode output from commands run by pointers and from
+ POD processing by Pod::Thread. Previous versions since 6.01 were
+ double-encoding. Thanks to Julien ÉLIE for the report.
+
- Follow symlinks to ordinary files in docknot spin, just not
directories. The Path::Iterator::Rule conversion in 6.01 broke copying
of files referenced by symlink.
diff --git a/lib/App/DocKnot/Spin.pm b/lib/App/DocKnot/Spin.pm
index 105b7f0..f28c067 100644
--- a/lib/App/DocKnot/Spin.pm
+++ b/lib/App/DocKnot/Spin.pm
@@ -23,6 +23,7 @@ use App::DocKnot::Spin::Sitemap;
use App::DocKnot::Spin::Thread;
use App::DocKnot::Spin::Versions;
use App::DocKnot::Util qw(is_newer print_checked print_fh);
+use Encode qw(decode);
use Git::Repository ();
use IPC::System::Simple qw(capture);
use Path::Iterator::Rule ();
@@ -186,6 +187,7 @@ sub _cl2xhtml {
my ($self, $source, $output, $options, $style) = @_;
$style ||= $self->{style_url} . 'changelog.css';
my @page = capture("cl2xhtml $options -s $style $source");
+ @page = map { decode('utf-8', $_) } @page;
my $footer = sub {
my ($blurb, $id) = @_;
if ($blurb) {
@@ -216,6 +218,7 @@ sub _cvs2xhtml {
# Run the converter and write the output.
my @page = capture("(cd $dir && cvs log $name) | cvs2xhtml $options");
+ @page = map { decode('utf-8', $_) } @page;
my $footer = sub {
my ($blurb, $id, $file) = @_;
if ($blurb) {
@@ -234,6 +237,7 @@ sub _faq2html {
my ($self, $source, $output, $options, $style) = @_;
$style ||= $self->{style_url} . 'faq.css';
my @page = capture("faq2html $options -s $style $source");
+ @page = map { decode('utf-8', $_) } @page;
my $footer = sub {
my ($blurb, $id, $file) = @_;
if ($blurb) {
@@ -270,6 +274,7 @@ sub _pod2html {
my $data;
$podthread->output_string(\$data);
$podthread->parse_file("$source");
+ $data = decode('utf-8', $data);
# Spin that thread into HTML.
my $page = $self->{thread}->spin_thread($data);
diff --git a/lib/App/DocKnot/Spin/Pointer.pm b/lib/App/DocKnot/Spin/Pointer.pm
index a16250c..160b11e 100644
--- a/lib/App/DocKnot/Spin/Pointer.pm
+++ b/lib/App/DocKnot/Spin/Pointer.pm
@@ -136,6 +136,7 @@ sub _spin_pod {
my $data;
$podthread->output_string(\$data);
$podthread->parse_file("$source");
+ $data = decode('utf-8', $data);
# Spin that page into HTML.
$self->{thread}->spin_thread_output($data, $source, 'POD', $output);