Issue 11 in salesforce-beatbox: Unicode issue when running under Jython

16 views
Skip to first unread message

codesite...@google.com

unread,
Aug 12, 2010, 2:47:23 PM8/12/10
to plo...@googlegroups.com
Status: New
Owner: ----

New issue 11 by jbrendel: Unicode issue when running under Jython
http://code.google.com/p/salesforce-beatbox/issues/detail?id=11

What steps will reproduce the problem?
1. Install beatbox under Jython
2. Go through the usual steps to connect and login, then run a query, for
example: svc.query('select id from contact')
3. You will get an exception:

> File "/home/jbrendel/Packages/jython2.5.1/Lib/site-packages/beatbox-16.1-py2.5.egg/beatbox/xmltramp.py",
> line
> 104, in __unicode__
> text += unicode(x)
> UnicodeDecodeError: 'ascii' codec can't decode byte 0x19 in position 9:
> ordinal not in range(128)

What is the expected output? What do you see instead?

Should: Query results. Instead: Exception.


What version of the product are you using? On what operating system?

Latest version of beatbox, Jython 2.5.1, Ubuntu 9.10


Please provide any additional information below.

Yeah, so, Jython uses Java strings internally, which have unicode handling
built in. Therefore, often around this sort of thing you get issues.

Here's a really dumb patch I did, which seems to solve the problem (this is
in the __unicode__() function in xmltramp.py:

def __unicode__(self):
text = ''
for x in self._dir:
try:
text += unicode(x)
except UnicodeDecodeError, e:
text += x

return ' '.join(text.split())

For some reason, I can't just do 'text += x', even under Jython (and I have
no time to investigate why), but this here seems to do the trick, even
though it looks very strange.

Would be great if you could put this (or a better) patch in place, so that
official versions could contain this fix.


Reply all
Reply to author
Forward
0 new messages