Subject: | [PATCH] Let mandoc(1) produce UTF-8 output only if the user's locale asks for it. |
Date: | Tue, 4 Jun 2013 03:13:55 +0200 |
To: | bug-Pod-Perldoc [...] rt.cpan.org |
From: | Ingo Schwarze <schwarze [...] usta.de> |
Hello,
when using mandoc(1) as its groffer, perldoc(1) unconditionally
uses the -Tutf8 output mode. That mode is defined to produce UTF-8
output no matter what the user's locale is. So there is no way for
a user to have perldoc(1) _not_ throw UTF-8 at him or her...
I just committed a minimal fix to OpenBSD's in-tree perl
to use -Tlocale instead of -Tutf8, which will only use UTF-8
when the user's locale requests it, and ASCII otherwise.
Reading the mandoc-related code in Pod::Perldoc::ToMan, i noticed
some more opportunity for cleanup, so i will likely send a larger
patch shortly. Feel free to either pull this minimal fix straight
away or to wait for the larger patch, as you like.
Thanks for maintaining Perldoc,
Ingo
P.S.
Appending some info about my system, just in case, even though
i don't expect it to be relevant in this context...
--
Ingo Schwarze <schwarze@openbsd.org>
mandoc co-author and maintainer
----- 8< ----- schnipp ----- >8 ----- 8< ----- schnapp ----- >8 -----
From: Ingo Schwarze <schwarze@openbsd.org>
Date: Mon, 3 Jun 2013 19:24:16 -0400
Subject: [PATCH] Let mandoc(1) produce UTF-8 output only if the user's locale
asks for it.
---
lib/Pod/Perldoc/ToMan.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/Pod/Perldoc/ToMan.pm b/lib/Pod/Perldoc/ToMan.pm
index 80a944c..52fc2e8 100644
--- a/lib/Pod/Perldoc/ToMan.pm
+++ b/lib/Pod/Perldoc/ToMan.pm
@@ -263,7 +263,7 @@ sub _get_device_switches {
if( $self->_is_nroff ) { qw() }
elsif( $self->_have_groff_with_utf8 ) { qw(-Kutf8 -Tutf8) }
elsif( $self->_is_ebcdic ) { qw(-Tcp1047) }
- elsif( $self->_have_mandoc_with_utf8 ) { qw(-Tutf8) }
+ elsif( $self->_have_mandoc_with_utf8 ) { qw(-Tlocale) }
elsif( $self->_is_mandoc ) { qw() }
else { qw(-Tlatin1) }
}
--
1.8.2.2
----- 8< ----- schnipp ----- >8 ----- 8< ----- schnapp ----- >8 -----
ischwarze@isnote $ pwd
/usr/src/gnu/usr.bin/perl/cpan/Pod-Perldoc/lib/Pod
ischwarze@isnote $ grep 'VERSION =' Perldoc.pm
$VERSION = '3.17';
ischwarze@isnote $ perl -v | head -n2 | tail -n1
This is perl 5, version 16, subversion 3 (v5.16.3) built for i386-openbsd
ischwarze@isnote $ uname -a
OpenBSD isnote.usta.de 5.3 GENERIC.MP#5 i386
However, the above patch has been prepared
using git clone and then working on branch master.