From: <gh...@gh...> - 2003-07-24 23:29:33
|
Karsten Hilbert wrote: > Hello Gerhard, > >>>I'm having trouble with Unicode. I have set up the database to use UTF-8. >>>I am trying to get some non-ASCII strings in there and I am failing. > > >>>dBconnection=PgSQL.connect("::ctanWeb:ftpmaint:") >> >>You need to tell *pyPgSQL*, which client encoding to use. Use the >>parameter client_encoding="utf-8". > > Is this also necessary if I use a client encoding of, say, > "latin1" or "iso-8859-15" or some such? [...] If in your Python code you use Unicode strings, you need to: a) use client_encoding parameter in connect() call b) tell the PostgreSQL backend with "SET CLIENT_ENCODING TO ..." if in your Python code you use only byte strings, you need to: - tell the PostgreSQL backend with "SET CLIENT_ENCODING TO ..." All clear now? Or should I explain in more detail? -- Gerhard |