strange characters

From: "Manera, Villiam" <vmanera(at)manord(dot)com>
To: <psycopg(at)postgresql(dot)org>
Subject: strange characters
Date: 2011-01-10 14:32:24
Message-ID: 4B0D10F422F80F479C5372363DE21FB1026A2E36@mail2.manord.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

I try the example in the manual:

SQL = "INSERT INTO authors (name) VALUES (%s);"

data = ("O'Reilly", )

cur.mogrify(SQL,data)

"INSERT INTO authors (name) VALUES (E'O''Reilly');"

strange characters:

àE'ß

The same in

>>> cur.mogrify("select * from xxx where coll='%(coll)s'",{'coll':'1'});

"select * from xxx where coll='E'1''"

Instead with number work fine:

>>> cur.mogrify("select * from xxx where coll='%(coll)s'",{'coll':1});

"select * from xxx where coll='1'"

Environment:

Server: PostgreSQL 9.0.1 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48), 64-bit

psycopg2-2.3.1

Villiam

Responses

Browse psycopg by date

  From Date Subject
Next Message Adrian Klaver 2011-01-10 14:47:06 Re: strange characters
Previous Message Federico Di Gregorio 2011-01-09 23:05:09 Re: Already a psycopg2 type for postGIS geographic points?