How to 'de-slashify' a string?
ak at nothere.com
Sat Aug 22 10:20:23 CEST 2009
Hi, if I have a string '\\303\\266', how can I convert it to '\303\266'
in a general way?
The problem I'm running into is that I'm connecting with pygresql to a
postgres database and when I get fields that are of 'char' type, I get
them in unicode, but when I get fields of 'byte' type, I get the text
with quoted slashes, e.g. '\303' becomes '\\303' and so on.
I saw posts online to do
cursor.execute("set client-encoding to unicode")
before running queries but this command causes an error.
So I think I need a way to de-quote the slashes or alternatively
some way to tell pygresql not to quote slashes for 'byte' fields.
Any help, hints, etc appreciated..
More information about the Python-list