Patchwork Decode patch from UTF-8 while parsing from stdin

login
register
mail settings
Submitter Martin Krafft
Date Feb. 5, 2010, 3:33 a.m.
Message ID <1265340805-25653-1-git-send-email-madduck@madduck.net>
Download mbox | patch
Permalink /patch/44606/
State Accepted
Headers show

Comments

Martin Krafft - Feb. 5, 2010, 3:33 a.m.
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>
---
 apps/patchwork/parser.py |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
Paul Menzel - Dec. 10, 2010, 10:30 a.m.
Am Freitag, den 05.02.2010, 04:33 +0100 schrieb martin f. krafft:
> 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>

I think this patch needs to be reapplied, after the branch change(?) in
March 2010 [1].

Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>


[1] http://lists.ozlabs.org/pipermail/patchwork/2010-March/000251.html

> ---
>  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:
Jeremy Kerr - Dec. 13, 2010, 12:37 a.m.
Hi Paul,

> I think this patch needs to be reapplied, after the branch change(?) in
> March 2010 [1].

Thanks, good catch, I've reapplied it.

Cheers,


Jeremy

Patch

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: