seandavi / gitinspector

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

UnicodeEncodeError: 'charmap' codec can't encode character u'\u20ac' in position 280169: character maps to <undefined> #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. gitinspector\gitinspector.py --format=html

What is the expected output? What do you see instead?
Statistics of repository, instead only an error message:

C:\Tools\gitinspector>c:\Python27\python.exe gitinspector\gitinspector.py 
--format=html
Traceback (most recent call last):
  File "gitinspector\gitinspector.py", line 145, in <module>
    main()
  File "gitinspector\gitinspector.py", line 142, in main
    __run__.output()
  File "gitinspector\gitinspector.py", line 56, in output
    format.output_header()
  File "C:\Tools\gitinspector\gitinspector\format.py", line 71, in output_header
    print(html_header.format(version.__version__, jquery_js, tablesorter_js, flot_js, pie_js, logo.decode("utf-8", "replace")))
  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'\u20ac' in 
position 280169: character maps to <undefined>

What version of the product are you using? On what operating system?
2bfb3cfa6709aaf5b4b30401b20c78292535043a (as of 2013-06-18)
Windows 7
Python2.7.4 or 3.3.0 (same error message)

Please provide any additional information below.
Version tried already includes commit for issue #4 which sounds similar.

Original issue reported on code.google.com by hdeis...@gmail.com on 20 Jun 2013 at 9:43

GoogleCodeExporter commented 9 years ago
Good catch. It looks like there is something "wrong" in the new flot archive; 
it was upgraded recently. Could you try with revision 293edef4bb40 and see if 
that works? That is the version with the old flot archive, just before the 
change.

/Adam Waldenberg

Original comment by gitinspe...@ejwa.se on 20 Jun 2013 at 12:37

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I googled a little and found a related discussion over at:
http://stackoverflow.com/questions/6788158/handling-unicode-strings-in-windows

So it seems related to the cp850 encoding, which is also apparent from the 
trace above. It is probably just be the Windows terminal playing tricks in 
relation to unicode. Try redirecting to a file with:

gitinspector\gitinspector.py --format=html > myfile.html

See if that works. It "should" bypass the codec (cp850) specified by the 
terminal and default back to UTF-8.

/Adam Waldenberg

Original comment by gitinspe...@ejwa.se on 20 Jun 2013 at 12:57

GoogleCodeExporter commented 9 years ago
I've tried both, older version and redirect. And additionally I've tried to run 
from bash.

Older version and running from bash gives the same error message. 
Redirect results in a slightly different one:
C:\Tools\gitinspector>gitinspector\gitinspector.py --format=html > a.html
Traceback (most recent call last):
  File "C:\Tools\gitinspector\gitinspector\gitinspector.py", line 145, in <module>
    main()
  File "C:\Tools\gitinspector\gitinspector\gitinspector.py", line 142, in main
    __run__.output()
  File "C:\Tools\gitinspector\gitinspector\gitinspector.py", line 56, in output
    format.output_header()
  File "C:\Tools\gitinspector\gitinspector\format.py", line 71, in output_header
    print(html_header.format(version.__version__, jquery_js, tablesorter_js, flot_js, pie_js, logo.decode("utf-8", "replace")))
  File "C:\Python27\lib\codecs.py", line 352, in write
    self.stream.write(data)
IOError: [Errno 9] Bad file descriptor

harald

Original comment by hdeis...@gmail.com on 21 Jun 2013 at 6:21

GoogleCodeExporter commented 9 years ago
So there seems to be several things going wrong under Windows. Looks like I 
will have to fire up Windows and reproduce these two errors.

I will look into this as soon as possible.

/Adam Waldenberg

Original comment by gitinspe...@ejwa.se on 21 Jun 2013 at 9:29

GoogleCodeExporter commented 9 years ago
I tried to reproduce the second error (bad file descriptor) on my Windows 7 
installation with no luck.

I executed gitinspector with "-F html > file.html" from the DOS cmd window and 
Powershell; it worked flawlessly in both. I'm going to assume that it's 
something in your specific environment that is causing it.

When it comes to the first error you reported, I will strip the "€" character 
(\u20ac) from the table-sorting plugin that gitinspector uses. This is used by 
the currency sorting feature in the table sorter (something not being used in 
gitinspector anyway). It seems the € (euro character) is missing from quite a 
few encodings so it's not really worth to keep it around.

Try putting the file (jqery.tablesorter.min.js.zip) I'm attaching to this post 
in the gitinspector/html directory. I have removed the euro character in this 
file. Tell me if it fixes the encoding error.

/Adam Waldenberg

Original comment by gitinspe...@ejwa.se on 23 Jun 2013 at 6:16

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Concerning the second error again; make sure you have write permissions to the 
directory when you run:

"C:\Tools\gitinspector>gitinspector\gitinspector.py --format=html > a.html"

Just passing "a.html" will output the file to the current directory. Maybe this 
is what's causing the error?

/Adam Waldenberg

Original comment by gitinspe...@ejwa.se on 23 Jun 2013 at 6:48

GoogleCodeExporter commented 9 years ago
I get mixed results.

The udated jquery.tablesorter.min.js.zip did not help.

But I tried on an alternative system - there its running (as long as I redirect 
to a file) fine.

Harald

Original comment by hdeis...@gmail.com on 24 Jun 2013 at 6:30

GoogleCodeExporter commented 9 years ago
OK. The reported error should be slightly different then; considering that the 
"€" character is now striped out. Could you paste in the current error?

/Adam Waldenberg

Original comment by gitinspe...@ejwa.se on 24 Jun 2013 at 11:03

GoogleCodeExporter commented 9 years ago
This issue was closed by revision e15ee100a2a4.

Original comment by gitinspe...@ejwa.se on 30 Jun 2013 at 4:35

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I will consider this as resolved. The revision above should, after all, fix the 
original error message.

/Adam Waldenberg

Original comment by gitinspe...@ejwa.se on 30 Jun 2013 at 4:39