Skip site navigation (1) Skip section navigation (2)

Re: bug in Google translate snippet

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, pg-peter(at)alvh(dot)no-ip(dot)org
Subject: Re: bug in Google translate snippet
Date: 2009-07-02 21:39:14
Message-ID: 20090702213914.GN4698@alvh.no-ip.org (view raw or flat)
Thread:
Lists: 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: ordinal not 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

In response to

Responses

pgsql-hackers by date

Next:From: Andrew DunstanDate: 2009-07-02 21:43:43
Subject: Re: TODO items
Previous:From: Tom LaneDate: 2009-07-02 21:39:08
Subject: Re: PGXS problem with pdftotext

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group