"[EMAIL PROTECTED] via RT" <[EMAIL PROTECTED]> writes:

> As reported in <http://bugs.debian.org/480565>, pod2man seems to
> overescape dashes when dealing with non-ascii characters.
>
> % echo -e '=pod\n\nE<eth>' | pod2man | tail -1
> \&\*(d\-
>
> This should apparently be \d- instead.
>
> Thanks for your work on the Pod::* modules,

Indeed, thanks.  Here's the fix, which will be in the next release.

Index: lib/Pod/Man.pm
===================================================================
RCS file: /home/eagle/cvs/pod/lib/Pod/Man.pm,v
retrieving revision 2.16
diff -u -p -r2.16 Man.pm
--- lib/Pod/Man.pm      29 Nov 2007 01:35:53 -0000      2.16
+++ lib/Pod/Man.pm      12 May 2008 22:44:01 -0000
@@ -348,23 +348,22 @@ sub format_text {
     my $convert = $$options{convert};
     my $literal = $$options{literal};
 
-    # Normally we do character translation, but we won't even do that in
-    # <Data> blocks.
-    if ($convert) {
-        if (ASCII) {
-            $text =~ s/(\\|[^\x00-\x7F])/$ESCAPES{ord ($1)} || "X"/eg;
-        } else {
-            $text =~ s/(\\)/$ESCAPES{ord ($1)} || "X"/eg;
-        }
-    }
-
     # Cleanup just tidies up a few things, telling *roff that the hyphens are
-    # hard and putting a bit of space between consecutive underscores.
+    # hard, putting a bit of space between consecutive underscores, and
+    # escaping backslashes.  Be careful not to mangle our character
+    # translations by doing this before processing character translation.
     if ($cleanup) {
+        $text =~ s/\\/\\e/g;
         $text =~ s/-/\\-/g;
         $text =~ s/_(?=_)/_\\|/g;
     }
 
+    # Normally we do character translation, but we won't even do that in
+    # <Data> blocks.
+    if ($convert && ASCII) {
+        $text =~ s/([^\x00-\x7F])/$ESCAPES{ord ($1)} || "X"/eg;
+    }
+
     # Ensure that *roff doesn't convert literal quotes to UTF-8 single quotes,
     # but don't mess up our accept escapes.
     if ($literal) {
@@ -1294,9 +1293,6 @@ sub parse_from_filehandle {
     "o\\*/" , "u\\*`", "u\\*'", "u\\*^",   "u\\*:", "y\\*'", "\\*(th", "y\\*:",
 ) if ASCII;
 
-# Make sure that at least this works even outside of ASCII.
-$ESCAPES{ord("\\")} = "\\e";
-
 ##############################################################################
 # Premable
 ##############################################################################

-- 
Russ Allbery ([EMAIL PROTECTED])             <http://www.eyrie.org/~eagle/>



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to