~ubuntu-branches/ubuntu/raring/maradns/raring

« back to all changes in this revision

Viewing changes to update/1.2.12.04/maradns-1.2.12.03-perl_unicode_mess.patch

  • Committer: Bazaar Package Importer
  • Author(s): Kai Hendry
  • Date: 2010-01-24 12:17:40 UTC
  • mfrom: (1.1.13 upstream) (10.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20100124121740-a4e1fjobwaouz443
Tags: 1.4.02-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
--- maradns-1.2.12.03/tools/ej/ej2man   2006-06-21 03:59:30.000000000 -0500
2
 
+++ maradns-1.2.12.04/tools/ej/ej2man   2006-10-25 21:40:23.000000000 -0500
3
 
@@ -16,18 +16,11 @@
4
 
 # Perl at /usr/local/bin/perl then anywhere else in the user's path.
5
 
 
6
 
 #!/usr/local/bin/perl
7
 
-
8
 
 # Convert an ej-formatted doc in to a man page
9
 
 # Input: First argument or standard input
10
 
 # Output: Standard output
11
 
 
12
 
-# Determine the version of Perl we are using
13
 
-$vers=sprintf("%vd",$^V);
14
 
-# 5.8.0 needs the following line
15
 
-if($vers =~ /5.8.0/) {
16
 
-    print "Sorry, this verion of Perl is broken with Unicode characters\n";
17
 
-    exit 1;
18
 
-    }
19
 
+$FILENAME = shift || "/////";
20
 
 
21
 
 # Tmp dir (used for running iconv on non-8859-1 pages)
22
 
 $TMP = $ENV{'HOME'} . "/tmp";
23
 
@@ -39,7 +32,26 @@
24
 
 
25
 
 # Read in the doc
26
 
 
27
 
-while(<>){$doc .= $_}
28
 
+# This makes the script happy when run with both Perl 5.8.0 and
29
 
+# Perl 5.8.8; basically 5.8.0 had a lot of unhappy Unicode bugs
30
 
+# and so they changed the behavior for later releases.  It is possible
31
 
+# to make a Unicode-happy script that runs unchanged Unicode-happy
32
 
+# on both 5.8.0 and 5.8.8, but the contortions I had to do were
33
 
+# amazing.
34
 
+
35
 
+# I would like to thank all of the helpful people in the newsgroup
36
 
+# comp.lang.perl.misc for their assistance; I couldn't have done it
37
 
+# without them.
38
 
+
39
 
+use utf8;
40
 
+if($FILENAME ne "/////") {
41
 
+    close(STDIN);
42
 
+    open(STDIN,"< $FILENAME");
43
 
+    }
44
 
+
45
 
+binmode(STDIN,":utf8");
46
 
+
47
 
+while(<STDIN>){$doc .= $_}
48
 
 
49
 
 #$* = 1; # Match multiple lines
50
 
 
51
 
@@ -227,7 +239,7 @@
52
 
               $parts[$hack] =~ s/\'/\\\(aq/g;
53
 
                # Handle the á character (Debian's lint complains if the 
54
 
                # man page has raw hi-bit characters)
55
 
-               $parts[$hack] =~ s|á|\\\(\'a|g;
56
 
+               $parts[$hack] =~ s|\xc3\xa1|\\\(\'a|g;
57
 
               $body .= $parts[$hack];
58
 
               $body .= ".fi\n";
59
 
               }