[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

UnicodeDecodeError getting revision log with Python

From: Jack Bates <ms419_at_freezone.co.uk>
Date: Tue, 26 May 2009 16:28:45 -0700

A script we use for XMPP commit notification occasionally complains,

[...]
exceptions.UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in
position 21: ordinal not in range(128)

- see the Traceback at end of this message

It complains on revisions where the log contains accented characters,
e.g. http://code.google.com/p/qubit-toolkit/source/detail?r=2584

I reproduced this error with the latest trunk version of Subversion and
Python SWIG bindings, revision 37835, should I file an issue for this?

These are the steps I followed to reproduce this error,

$ svn co http://svn.collab.net/repos/svn/trunk svn
[...]
$ ./autogen.sh
[...]
$ ./configure
[...]
$ make
[...]
$ make swig-py
[...]
$ PYTHONPATH=subversion/bindings/swig/python/.libs:subversion/bindings/swig/python python
[...]
>>> import svn.repos
>>> repos = svn.repos.open('/var/lib/svn')
>>> fs = svn.repos.fs(repos)
>>> log = svn.fs.revision_prop(fs, 2584, svn.core.SVN_PROP_REVISION_LOG)
>>> u"".join([log])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 10: ordinal not in range(128)
>>>

This is the Traceback from our XMPP commit notification script,

/var/lib/python-support/python2.6/svn/fs.py:27: DeprecationWarning: The
popen2 module is deprecated. Use the subprocess module.
  import sys as _sys, os as _os, popen2 as _popen2, tempfile as
_tempfile
Traceback (most recent call last):
  File "/build/buildd/python2.6-2.6.2/Modules/pyexpat.c", line 656, in
EndElement
    
  File "/usr/lib/python2.6/dist-packages/twisted/words/xish/domish.py",
line 797, in _onEndElement
    self.ElementEvent(self.currElem)
  File
"/usr/lib/python2.6/dist-packages/twisted/words/xish/xmlstream.py", line
107, in onElement
    self.dispatch(element)
  File "/usr/lib/python2.6/dist-packages/twisted/words/xish/utility.py",
line 317, in dispatch
    callbacklist.callback(obj)
--- <exception caught here> ---
  File "/usr/lib/python2.6/dist-packages/twisted/words/xish/utility.py",
line 107, in callback
    methodwrapper(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/twisted/words/xish/utility.py",
line 27, in __call__
    self.method(*nargs, **nkwargs)
  File "src/jabber/jabber", line 53, in presence
    self.xmlstream.send(message)
  File
"/usr/lib/python2.6/dist-packages/twisted/words/protocols/jabber/xmlstream.py", line 595, in send
    prefixesInScope=self.prefixes.values())
  File "/usr/lib/python2.6/dist-packages/twisted/words/xish/domish.py",
line 544, in toXml
    return s.getValue()
  File "/usr/lib/python2.6/dist-packages/twisted/words/xish/domish.py",
line 44, in getValue
    return u"".join(self.writelist)
exceptions.UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in
position 21: ordinal not in range(128)

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2354624
Received on 2009-05-27 01:29:24 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.