]> git.ozlabs.org Git - patchwork/commitdiff
Decode patch from UTF-8 while parsing from stdin
authormartin f. krafft <madduck@madduck.net>
Fri, 5 Feb 2010 03:33:25 +0000 (04:33 +0100)
committerJeremy Kerr <jk@ozlabs.org>
Mon, 13 Dec 2010 00:22:21 +0000 (08:22 +0800)
Patchwork (rightfully) hashes patches using UTF-8:

  parser.py:
    def hash_patch(str):
      […]
      hash.update(line.encode('utf-8') + '\n')

This patch makes sure that it treats the incoming data as UTF-8 as well.

Signed-off-by: martin f. krafft <madduck@madduck.net>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
apps/patchwork/parser.py

index 2b5e9a093c478756d65ef001cdb59e48eb0af0c5..24631b739822fde096f3f748343410be8ec2be3d 100644 (file)
@@ -63,8 +63,7 @@ def parse_patch(text):
     lc = (0, 0)
     hunk = 0
 
-
-    for line in text.split('\n'):
+    for line in text.decode('utf-8').split('\n'):
         line += '\n'
 
         if state == 0: