ejwa / gitinspector

:bar_chart: The statistical analysis tool for git repositories
GNU General Public License v3.0
2.35k stars 324 forks source link

Error if author name contains non ascii chars like "ó" in "Antón" #150

Closed matutet closed 7 years ago

matutet commented 7 years ago

I trying to use gitinspector on my repositories. All of them have authors with non ascii chars in its names (we are spanish developers).

Traceback (most recent call last):
  File "/Users/matutet/wrkspc.others/gitinspector/gitinspector.py", line 24, in <module>
    gitinspector.main()
  File "/Users/matutet/wrkspc.others/gitinspector/gitinspector/gitinspector.py", line 206, in main
    run.process(repos)
  File "/Users/matutet/wrkspc.others/gitinspector/gitinspector/gitinspector.py", line 83, in process
    outputable.output(ChangesOutput(summed_changes))
  File "/Users/matutet/wrkspc.others/gitinspector/gitinspector/output/outputable.py", line 43, in output
    outputable.output_text()
  File "/Users/matutet/wrkspc.others/gitinspector/gitinspector/output/changesoutput.py", line 151, in output_text
    print(terminal.ljust(i, 20)[0:20 - terminal.get_excess_column_count(i)], end=" ")
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf3' in position 9: ordinal not in range(128)

I am using MacOS. Not tested on other operating systems.

adam-waldenberg commented 7 years ago

Hi @matutet. Gitinspector is behaving correctly. If you read traceback you can see that your terminal encoding is set to ascii - as such, it won't be able to display those international unicode characters in your terminal. This has been discussed several times before. See for example issues #122 and #9 for information on how to fix it. You can also redirect to a text file to get rid of the problem.

matutet commented 7 years ago

You're right. I was missing some locale vars. Now, after fixing it, is working

$ locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL="en_US.UTF-8"

Thanks for your quick answer. +1 for gitinspector :-)

adam-waldenberg commented 7 years ago

@matutet Good to hear. Enjoy gitinspector :).