From: Karsten H. <Kar...@gm...> - 2006-08-29 12:11:35
|
Sorry, forget the post below. I was totally blind. Sorry, Karsten On Tue, Aug 29, 2006 at 01:37:10PM +0200, Karsten Hilbert wrote: > User-Agent: Mutt/1.5.13 (2006-08-11) > Subject: [Pypgsql-users] possible problem with unicode_results = 1 > > Hello community, > > I am not sure I understand how unicode_results is supposed > to work right: > > Assume this: > > - client_encoding is set to 'iso8859-1' at the connect() level > - hence "set client_encoding" must also be set to 'iso8859-1' at the SQL level > - thereby, strings *returning* from the database are encoded > as 'iso8859-1', too, when they enter pyPgSQL from libpq > > - now I want to have results in unicode > - hence I set unicode_results=1 at the connect() level > - thereby string-types are passed to unicode() in pyPgSQL > without further arguments as per the code > - hence unicode() uses the default encoding as per Python docs > - which in most cases is "ascii" > - bad things happen > > Really, the client_encoding value should be passed in to > unicode() as well, shouldn't it ? > > Or is my logic flawed ? > > No, it is not always possible to set the Python default > string encoding to something sane as would seem prudent to > do. It is not recommended to do so, either. > > Karsten > -- > GPG key ID E4071346 @ wwwkeys.pgp.net > E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346 > > ------------------------------------------------------------------------- > 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 > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Pypgsql-users mailing list > Pyp...@li... > https://lists.sourceforge.net/lists/listinfo/pypgsql-users > -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346 |