mirror of
https://github.com/ejwa/gitinspector.git
synced 2024-11-16 00:28:25 +01:00
Fixed some UnicodeEncodeError exceptions that could occur with Python 2.
This commit is contained in:
parent
99dc2c4735
commit
35214550f3
1 changed files with 4 additions and 0 deletions
|
@ -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]
|
||||
|
||||
|
|
Loading…
Reference in a new issue