Add support for unicode characters
WouterButhker opened this issue · comments
I'm trying to run the gitinspector on my repository but it seems to fail because there is a contributor with a special character (ă) in her name
Statistical information for the repository 'Git' was gathered on 2020/04/05.
The following historical commit information, by author, was found:
�[1mAuthor Commits Insertions Deletions % of changes�[0;0m
Ana Baltaretu 93 6060 2691 21.45
Traceback (most recent call last):
File "gitinspector.py", line 24, in <module>
gitinspector.main()
File "gitinspector.py", line 206, in main
run.process(repos)
File "gitinspector\gitinspector.py", line 83, in process
outputable.output(ChangesOutput(summed_changes))
File "gitinspector\output\outputable.py", line 43, in output
outputable.output_text()
File "gitinspector\output\changesoutput.py", line 151, in output_text
print(terminal.ljust(i, 20)[0:20 - terminal.get_excess_column_count(i)], end=" ")
File "C:\Python27\lib\encodings\cp850.py", line 12, in encode
return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode character u'\u0103' in position 5: character maps to <undefined>
Hi @WouterButhker. Not a gitinspector issue. You don't have a an encoding that can show that character set in your terminal. This is why you get "unknown". There are other older issues that discuss this. #161 is one example.
In a nutshell, gitinspector will ask your terminal for the encoding. If the terminal can't map it this is the error you get. One solution is to redirect the output to a file (this will default to UTF-8).