[Po4a-commits] r2254 - /trunk/lib/Locale/Po4a/Po.pm

barbier-guest at users.alioth.debian.org barbier-guest at users.alioth.debian.org
Thu Sep 23 19:07:10 UTC 2010


Author: barbier-guest
Date: Thu Sep 23 19:07:07 2010
New Revision: 2254

URL: http://svn.debian.org/wsvn/po4a/?sc=1&rev=2254
Log:
Escape carriage returns when writing PO files

Modified:
    trunk/lib/Locale/Po4a/Po.pm

Modified: trunk/lib/Locale/Po4a/Po.pm
URL: http://svn.debian.org/wsvn/po4a/trunk/lib/Locale/Po4a/Po.pm?rev=2254&op=diff
==============================================================================
--- trunk/lib/Locale/Po4a/Po.pm (original)
+++ trunk/lib/Locale/Po4a/Po.pm Thu Sep 23 19:07:07 2010
@@ -1445,6 +1445,13 @@
                 (\\\\)*    #    followed by any even number of '\'
                )\\n        # and followed by an escaped newline
               /$1\n/sgx;   # single string, match globally, allow comments
+    # unescape carriage returns
+    $text =~ s/(           # $1:
+                (\G|[^\\]) #    beginning of the line or any char
+                           #    different from '\'
+                (\\\\)*    #    followed by any even number of '\'
+               )\\r        # and followed by an escaped carriage return
+              /$1\r/sgx;   # single string, match globally, allow comments
     # unescape tabulations
     $text =~ s/(          # $1:
                 (\G|[^\\])#    beginning of the line or any char
@@ -1468,6 +1475,7 @@
     $text =~ s/\\/\\\\/g;
     $text =~ s/"/\\"/g;
     $text =~ s/\n/\\n/g;
+    $text =~ s/\r/\\r/g;
     $text =~ s/\t/\\t/g;
     print STDERR ">$text<\n" if $debug{'escape'};
 




More information about the Po4a-commits mailing list