Ticket #303 (closed defect: fixed)

Opened 9 months ago

Last modified 9 months ago

http://trac.osgeo.org/proj/timeline <- Internal Error with UnicodeDecodeError

Reported by: neteler Assigned to: warmerdam
Priority: normal Component: SAC
Keywords: trac unicode Cc: hobu

Description

http://trac.osgeo.org/proj/timeline reports only this Internal Error:

Repository checkins event provider (ChangesetModule) failed:
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 41-43: invalid data

likely due to CVS -> SVN migration of PROJ4.

Here is some material: http://trac.edgewall.org/wiki/UnicodeDecodeError which may be helpful.

Markus

Change History

10/19/08 17:48:29 changed by martin

I'm yet not up to having a clue here ....

According to the mentioned page at "edgewall" I understand that either a different character conversion should have been applied while converting from CVS to SVN or a more recent release of Trac might solve the problem.

Anyone's experienced about configuring Trac !?

Cheers, Martin.

10/21/08 11:43:47 changed by warmerdam

  • cc set to hobu.
  • owner changed from sac@lists.osgeo.org to warmerdam.

(follow-up: ↓ 4 ) 10/21/08 12:40:46 changed by warmerdam

  • keywords changed from trac to trac unicode.
  • status changed from new to closed.
  • resolution set to fixed.

Circa line 69 of /usr/lib/python2.3/site-packages/trac/db/sqlite_backend.py I have changed this:

        def _convert_row(self, row):
            return tuple([(isinstance(v, str) and [v.decode('utf-8')] or [v])[0]
                          for v in row])

to:

        def _convert_row(self, row):
            result = []
            for v in row:
                if isinstance(v,str):
                    try:
                        item = v.decode('utf-8')
                    except:
                        item = '(undecodable utf-8 string)'
                else:
                    item = v

                result.append(item)
            return tuple(result)
        
            #return tuple([(isinstance(v, str) and [v.decode('utf-8')] or [v])[0]
            #              for v in row])

This seems to successfully replace untranslatable unicode messages with "(undecodable utf-8 string)". It turns out one of the commit messages include special characters.

If we upgrade Trac we may need to re-apply a variation of this patch.

I did review cvs2svn and it was not immediately obvious how to rerun the translation in such a way that the corrupt string would not be in the log messages.

(in reply to: ↑ 3 ) 10/21/08 13:51:54 changed by neteler

Replying to warmerdam: ...

This seems to successfully replace untranslatable unicode messages with "(undecodable utf-8 string)". It turns out one of the commit messages include special characters. If we upgrade Trac we may need to re-apply a variation of this patch. I did review cvs2svn and it was not immediately obvious how to rerun the translation in such a way that the corrupt string would not be in the log messages.

Here is the GRASS conversion script which does some encoding magic: http://josef.fsv.cvut.cz/~landa/grass-cvs2svn/grass-cvs2svn-base.sh

Maybe helpful...