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

Re: UnicodeDecodeError getting revision log with Python

From: David James <james82_at_gmail.com>
Date: Thu, 28 May 2009 15:58:19 -0700

On Thu, May 28, 2009 at 10:47 AM, Jack Bates <ms419_at_freezone.co.uk> wrote:
>> Jack Bates wrote:
>> > 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)
>>
>> Google(python UnicodeDecodeError ordinal) returns
>> <http://www.xinotes.org/notes/note/391/>. Does that help?
>
> Thanks Julian, if I understand correctly, svn.fs.revision_prop() returns
> a bytestring and I need to know the encoding of the bytestring to decode
> it to a unicode object?

Yes, that's right. A good guess would be to check if the log message
is UTF-8. Subversion standardizes on UTF-8 internally, but I don't
think we verify that log messages are UTF-8 -- I think that users can
encode their log messages using any encoding they want.

> Is there something in the Subversion Python bindings to return a decoded
> unicode object instead of a bytestring?

No, I don't think so.

Cheers,

David

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2356609
Received on 2009-05-29 00:59:12 CEST

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