[Monetdb-developers] a little unicode fix in MapiClient.py
Niels.Nes at cwi.nl
Tue May 23 09:20:09 CEST 2006
On Sun, May 14, 2006 at 10:19:41AM +0200, Fabian Groffen wrote:
Your fix does indeed fix the problem for a machine with utf8 locale. However
there exist many other unicode encodings. As pythons unicode implementation
doesn't allow for asking for the 'default' unicode encoding we cannot
generally fix this. Therefor I think we should stay with the current code
which takes the default encoding (ascii), which indeed has problems with
our utf8 input strings.
I Hope this explains the problem a bit.
> Hi Max,
> Thanks for your interest in MonetDB and your patch.
> On 14-05-2006 11:21:45 +0400, Max wrote:
> > Steps to reproduce problem:
> > 1. MonetDB-4.10.2, Python 2.3.4, Gentoo Linux 2005.0, LANG=ru_RU.KOI8-R
> Just for the record, are you running x86, ppc, amd64...?
> > #MapiClient (python) connected to localhost:50000 as max
> > > vars();
> > Traceback (most recent call last):
> > File "/usr/share/MonetDB/python/Mapi.py", line 67, in result
> > while buffer[-len(self.prompt1):] != self.prompt1 and \
> > UnicodeDecodeError: 'ascii' codec can't decode byte 0x81 in position 0: ordinal not in range(128)
> > Possible patch:
> > --- MonetDB-4.10.2/src/mapi/clients/python/MapiClient.py.in 2006-01-20 23:36:49.000000000 +0700
> > +++ MonetDB-4.10.2/src/mapi/clients/python/MapiClient.py.in.fixed 2006-05-14 15:15:19.000000000 +0800
> > @@ -57,7 +57,7 @@
> > sys.stdout.write(s.prompt)
> > line = fi.readline()
> > while line and line != "quit;\n":
> > - res = s.cmd(line)
> > + res = s.cmd(line).encode('utf-8')
> > print res
> > sys.stdout.write(s.prompt.encode('utf-8'))
> > line = fi.readline()
> Your patch looks most reasonable to me, but I'm not a python expert.
> Maybe Niels or Sjoerd can have a look at this. This patch solves the
> problem for you, right? I guess in your vars there are some paths with
> Russian characters which triggers the problem, or something like that?
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> Monetdb-developers mailing list
> Monetdb-developers at lists.sourceforge.net
Niels Nes, Centre for Mathematics and Computer Science (CWI)
Kruislaan 413, 1098 SJ Amsterdam, The Netherlands
room C0.02, phone ++31 20 592-4098, fax ++31 20 592-4312
url: http://www.cwi.nl/~niels e-mail: Niels.Nes at cwi.nl
More information about the developers-list