Re: bug in Google translate snippet - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: bug in Google translate snippet
Date
Msg-id 20090702213914.GN4698@alvh.no-ip.org
Whole thread Raw
In response to Re: bug in Google translate snippet  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: bug in Google translate snippet
Re: bug in Google translate snippet
List pgsql-hackers
Andrew Dunstan wrote:
>
>
> Alvaro Herrera wrote:
>> Hi,
>>
>> I was having a look at this snippet:
>> http://wiki.postgresql.org/wiki/Google_Translate
>> and it turns out that it doesn't work if the result contains non-ASCII
>> chars.  Does anybody know how to fix it?
>>
>> alvherre=# select gtranslate('en', 'es', 'he');
>> ERROR:  plpython: function "gtranslate" could not create return value
>> DETALLE:  <type 'exceptions.UnicodeEncodeError'>: 'ascii' codec can't encode character u'\xe9' in position 0:
ordinalnot in range(128)
 
>
> This looks like a python issue rather than a Postgres issue. The problem  
> is probably in python-simplejson.

I think the problem happens when the PL tries to create the output
value.  Otherwise I wouldn't be able to see the value in plpy.log.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: PGXS problem with pdftotext
Next
From: Andrew Dunstan
Date:
Subject: Re: TODO items