[PATCH 5/5] parser: Convert stdin to utf-8 before processing
Nate Case
ncase at xes-inc.com
Fri Mar 20 05:59:56 EST 2009
When launching parser.py from the command line, stdin will get
the patch as type 'str'. The utf-8 encoding in the hash function
will fail if the patch has any unicode/non-ASCII characters present.
Patchwork doesn't appear to use parser.py from the command line
for anything, so this isn't a huge deal. I encountered this because
some external scripts use parser.py and choked on utf-8 patches.
Signed-off-by: Nate Case <ncase at xes-inc.com>
---
Rebased against latest HEAD.
apps/patchwork/parser.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/apps/patchwork/parser.py b/apps/patchwork/parser.py
index 16cc308..740019d 100644
--- a/apps/patchwork/parser.py
+++ b/apps/patchwork/parser.py
@@ -222,7 +222,7 @@ def main(args):
(options, args) = parser.parse_args()
- (patch, comment) = parse_patch(sys.stdin.read())
+ (patch, comment) = parse_patch(sys.stdin.read().decode('utf-8'))
if options.print_hash and patch:
print hash_patch(patch).hexdigest()
--
1.6.2
More information about the Patchwork
mailing list