Re: Unicode question
Gerhard Häring <[email protected]> Fri, 25 Jul 2003 01:29:30 +0200
| Newsgroups | gmane.comp.python.db.pypgsql.user |
|---|---|
| Message-ID | <[email protected]> |
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
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01