zer0c14 / gitinspector

Automatically exported from code.google.com/p/gitinspector
GNU General Public License v3.0
0 stars 0 forks source link

'charmap' codec can't encode character '\u0308' #42

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run "python .\gitinspector.py --grading --format=html --file-types=java,xml 
path\to\repo" on a repository which contains files with ÅÄÖ (?).

What is the expected output? What do you see instead?
Expected output: 
HTML file

Actual output:
Beginning of HTML file, but then an error:

Traceback (most recent call last):
  File ".\gitinspector.py", line 202, in <module>
  File ".\gitinspector.py", line 194, in main
  File ".\gitinspector.py", line 88, in output
  File "D:\Drive\Jobb\ITHS\2014 Java\Projekt 1\Inlämningar\gitinspector-0.3.2\gitinspector\outputable.py", line 36, in output
    outputable.output_html()
  File "D:\Drive\Jobb\ITHS\2014 Java\Projekt 1\Inlämningar\gitinspector-0.3.2\gitinspector\changes.py", line 256, in output_html
    print(changes_xml)
  File "C:\Python33\lib\encodings\cp850.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u0308' in position 
403: character maps to <undefined>

What version of the product are you using? What version of Python? On what
operating system?
Gitinspector 0.3.2
I'm using Windows 8, PowerShell and Python 3.3.

Please provide any additional information below.
I'm using windows, and the files I'm analysing were created on a Mac. I'm 
pretty sure the files contains ÅÄÖ characters.
\u0308 seems to be the ¨ symbol or something similar.

Original issue reported on code.google.com by Niklas.L...@gmail.com on 4 Nov 2014 at 4:20

GoogleCodeExporter commented 9 years ago
This simply means that you terminal is unable to accept the given character 
(\u0308). Meaning, the terminal encoding you are running (cp850) can't display 
the given character. Gitinspector will always try to convert the output to your 
encoding.

You have two options:
1. Change the encoding of your terminal to something that is able to cope with 
the 
   character.
2. Redirect the output to a file with ">". In this case Gitinspector should 
always try   
   to output pure UTF-8.

Original comment by gitinspe...@ejwa.se on 6 Nov 2014 at 9:59

GoogleCodeExporter commented 9 years ago
Thanks for the answer! 
Unfortunately, the error persists even though I redirect the output to a file.

Command:
python .\gitinspector.py --grading --format=html --file-types=java,xml 
path\to\repo > test.html

Could it perhaps still be the fault of my terminal?

Original comment by Niklas.L...@gmail.com on 6 Nov 2014 at 7:14

GoogleCodeExporter commented 9 years ago
The error does seem to indicate it... Try checking your PYTHONIOENCODING. Also, 
refer to issue 9 for some additional information.

Also, try the gitinspector version from the master branch to see if it makes 
any difference.

/Adam Waldenberg

Original comment by gitinspe...@ejwa.se on 12 Nov 2014 at 2:50

GoogleCodeExporter commented 9 years ago
Seeing that I'm not getting any feedback on this one I'm assuming this issue as 
invalid; considering it's most likely a problem with the terminal.

/Adam Waldenberg

Original comment by gitinspe...@ejwa.se on 3 Dec 2014 at 11:37