[Monetdb-developers] encoding of strings returned by Python client

Gijs Molenaar gijs.molenaar at cwi.nl
Tue Dec 22 15:58:28 CET 2009


Hi Mark,

Just committed the REAL/DOUBLE fix, this encoding thingy has to wait until January, sorry. 

On 22 dec 2009, at 13:43, Mark Bucciarelli wrote:

> On Tue, Dec 22, 2009 at 5:30 AM, Gijs Molenaar <gijs.molenaar at cwi.nl> wrote:
>> 
>> Do you know the behavior of other db API's?
>> 
> 
> MSQLdb has a use_encoding keyword.
> 
> The PostgreSql Django adapter had a set_client_encoding()
> method on the connection object.
> 
> The native SQLite3 Python module just returns Unicode.
> 
>> 
>> How big is the problem to do a manual
>> conversion to unicode in your wrapper?
>> 
> 
> Painful--I couldn't find a good place to hook
> in the code.
> 
>> 
>> The problem is that there isn't a real standard
>> way of doing this, at least not defined by the
>> python db API 2.0.
>> 
> 
> Yup, the PEP is encoding agnostic.
> 
> I though the path you started down was a good
> idea; pass a use_unicode keyword to the connection
> __init__().
> 
> Then if use_unicode = True, just decode("utf8") the
> string in __strip(), otherwise leave code as is.
> 
> m





More information about the developers-list mailing list