RE: Re: [viewvc-users] python 2.6 exception when viewing a file containing a

Tobias Grüninger <[email protected]>
Newsgroups gmane.comp.version-control.cvs.viewcvs.user
Message-ID <732328265.15297.1316074385831.JavaMail.httpd__48266.8667370037$1316074394$gmane$org@localhost>
> Thanks for the bug report.  Would it be possible for you to share with us
> the rest of this stack trace?  

Of course:

An Exception Has Occurred

Python Traceback

Traceback (most recent call last):
  File "/usr/lib/viewvc/lib/viewvc.py", line 4317, in main
    request.run_viewvc()
  File "/usr/lib/viewvc/lib/viewvc.py", line 397, in run_viewvc
    self.view_func(self)
  File "/usr/lib/viewvc/lib/viewvc.py", line 1763, in view_markup
    markup_or_annotate(request, 0)
  File "/usr/lib/viewvc/lib/viewvc.py", line 1696, in markup_or_annotate
    path[-1], mime_type)
  File "/usr/lib/viewvc/lib/viewvc.py", line 1589, in markup_stream_pygments
    encoding='utf-8'), ps)
  File "/usr/lib/pymodules/python2.6/pygments/__init__.py", line 86, in highlight
    return format(lex(code, lexer), formatter, outfile)
  File "/usr/lib/pymodules/python2.6/pygments/__init__.py", line 45, in lex
    return lexer.get_tokens(code)
  File "/usr/lib/pymodules/python2.6/pygments/lexer.py", line 137, in get_tokens
    text = text.decode('utf-8')
  File "/usr/lib/python2.6/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x92 in position 210: invalid start byte

Apparently, it happens in pygments lexer.py where this is not handled correctly:

if self.encoding == 'guess':
    try:
        text = text.decode('utf-8')
        if text.startswith(u'\ufeff'):
            text = text[len(u'\ufeff'):]
    except UnicodeDecodeError:
        text = text.decode('utf-8')
elif...

but should be as 2.6 default is 'strict'

if self.encoding == 'guess':
    try:
        text = text.decode('utf-8')
        if text.startswith(u'\ufeff'):
            text = text[len(u'\ufeff'):]
    except UnicodeDecodeError:
        text = text.decode('utf-8', errors='replace')
elif...

I will test when I can restart my apache.

Regards
Tobias

------------------------------------------------------
http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4255&dsMessageId=2839151

To unsubscribe from this discussion, e-mail: [[email protected]].
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.