[PATCH] Decode patch from UTF-8 while parsing from stdin

martin f. krafft madduck at madduck.net
Fri Feb 5 14:33:25 EST 2010


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 at madduck.net>
---
 apps/patchwork/parser.py |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/apps/patchwork/parser.py b/apps/patchwork/parser.py
index 16cc308..de81ca7 100644
--- a/apps/patchwork/parser.py
+++ b/apps/patchwork/parser.py
@@ -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:
-- 
1.6.5



More information about the Patchwork mailing list