From 35214550f35ffa5b5c4833758575ac1665208575 Mon Sep 17 00:00:00 2001 From: Adam Waldenberg Date: Mon, 13 May 2013 02:58:14 +0200 Subject: [PATCH] Fixed some UnicodeEncodeError exceptions that could occur with Python 2. --- changes.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/changes.py b/changes.py index 234b4bd..d25b346 100644 --- a/changes.py +++ b/changes.py @@ -45,12 +45,16 @@ class FileDiff: @staticmethod def get_extension(string): + string = string.encode("utf-8", "replace") + string = string.decode("utf-8", "replace") string = string.split("|")[0].strip().strip("{}").strip("\"").strip("'") string = codecs.getdecoder('unicode_escape')(string.strip())[0] return os.path.splitext(string)[1][1:] @staticmethod def get_filename(string): + string = string.encode("utf-8", "replace") + string = string.decode("utf-8", "replace") string = string.split("|")[0].strip().strip("{}").strip("\"").strip("'") return codecs.getdecoder('unicode_escape')(string.strip())[0]