Added "ignore" parameter to unicode_escape decodings (Fixes issue 4).

This commit is contained in:
Adam Waldenberg 2013-06-17 07:47:47 +02:00
parent a99758bcbb
commit 8a386225fd
3 changed files with 4 additions and 6 deletions

View file

@ -21,7 +21,6 @@ from __future__ import print_function
from __future__ import unicode_literals
from outputable import Outputable
from changes import FileDiff
import codecs
import comment
import filtering
import format
@ -92,7 +91,7 @@ class Blame:
lines = ls_tree_r.readlines()
for i, row in enumerate(lines):
row = codecs.getdecoder("unicode_escape")(row.strip())[0]
row = row.strip().decode("unicode_escape", "ignore")
row = row.encode("latin-1", "replace")
row = row.decode("utf-8", "replace").strip("\"").strip("'").strip()

View file

@ -20,7 +20,6 @@
from __future__ import print_function
from __future__ import unicode_literals
from outputable import Outputable
import codecs
import extensions
import filtering
import interval
@ -98,7 +97,7 @@ class Changes:
lines = git_log_r.readlines()
for i in lines:
j = codecs.getdecoder("unicode_escape")(i.strip())[0]
j = i.strip().decode("unicode_escape", "ignore")
j = j.encode("latin-1", "replace")
j = j.decode("utf-8", "replace")

View file

@ -18,9 +18,9 @@
# along with gitinspector. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function
from __future__ import unicode_literals
from outputable import Outputable
from changes import FileDiff
import codecs
import comment
import filtering
import interval
@ -37,7 +37,7 @@ class MetricsLogic:
stdout=subprocess.PIPE).stdout
for i in ls_tree_r.readlines():
i = codecs.getdecoder("unicode_escape")(i.strip())[0]
i = i.strip().decode("unicode_escape", "ignore")
i = i.encode("latin-1", "replace")
i = i.decode("utf-8", "replace").strip("\"").strip("'").strip()