Alexandre Julliard : patches: More robust utf-8 decoding.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Oct 15 07:28:54 CDT 2015


Module: tools
Branch: master
Commit: f612a2f657f40c96f94323af8ec871d469f55a9a
URL:    http://source.winehq.org/git/tools.git/?a=commit;h=f612a2f657f40c96f94323af8ec871d469f55a9a

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Oct 15 15:30:12 2015 +0900

patches: More robust utf-8 decoding.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 patches/update | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/patches/update b/patches/update
index a11d17e..fa8fd54 100755
--- a/patches/update
+++ b/patches/update
@@ -20,8 +20,6 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 use CGI qw(:standard);
-use open ':utf8';
-binmode STDOUT, ':utf8';
 
 my %status_descr =
 (
@@ -97,7 +95,7 @@ sub format_author($)
     return $str;
 }
 
-open INDEX, "> $dest/index.html.new" or die "cannot create $dest/index.html.new";
+open INDEX, ">:utf8", "$dest/index.html.new" or die "cannot create $dest/index.html.new";
 
 print INDEX start_html(-title=>"Patches list",
                        -encoding=>"utf-8",
@@ -126,15 +124,17 @@ foreach my $file (readdir DIR)
 {
     next unless $file =~ /^[0-9]+$/;
     my %patch;
-    next unless open PATCH, "<$dir/$file";
+    next unless open PATCH, "<:raw", "$dir/$file";
     while (<PATCH>)
     {
+        utf8::decode($_);
         if (/^Subject: (.*)$/) { $patch{"subject"} = $1; }
         elsif (/^From: (.*)$/) { $patch{"author"} = format_author($1); }
         last if (/^$/);
     }
     while (<PATCH>)
     {
+        utf8::decode($_);
         if (/^\s*Signed-off-by: (.*)$/) { push @{$patch{"signoff"}}, format_author($1); }
         last if (/^---$/);
     }
@@ -154,11 +154,12 @@ foreach my $file (readdir DIR)
         $patch{"order"} = <ORDER>;
         close ORDER;
     }
-    if (open SIGNOFF, "<$dir/$file.signoff")
+    if (open SIGNOFF, "<:raw", "$dir/$file.signoff")
     {
         while (<SIGNOFF>)
         {
             chomp;
+            utf8::decode($_);
             push @{$patch{"signoff"}}, format_author($_);
         }
         close SIGNOFF;
@@ -169,10 +170,11 @@ foreach my $file (readdir DIR)
     if (-f "$dir/$file.testbot")
     {
         $patch{"testbot"} = "OK";
-        if (open LOG, "<$dir/$file.testbot")
+        if (open LOG, "<:raw", "$dir/$file.testbot")
         {
             while (<LOG>)
             {
+                utf8::decode($_);
                 last if /^$/;
                 if (/^Job-ID: (.*)$/) { $patch{"testjob"} = $1; }
                 elsif (/^URL: (.*)$/) { $patch{"testurl"} = $1; }




More information about the wine-cvs mailing list