Re: strange characters - Mailing list psycopg

From Adrian Klaver
Subject Re: strange characters
Date
Msg-id 201101100700.09096.adrian.klaver@gmail.com
Whole thread Raw
In response to strange characters  ("Manera, Villiam" <vmanera@manord.com>)
List psycopg
On Monday 10 January 2011 6:32:24 am Manera, Villiam wrote:
> 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'"


Forgot to add the link to the docs in my previous post:

http://www.postgresql.org/docs/9.0/interactive/sql-syntax-lexical.html
See section 4.1.2.2. String Constants with C-Style Escapes


--
Adrian Klaver
adrian.klaver@gmail.com

psycopg by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: strange characters
Next
From: "Manera, Villiam"
Date:
Subject: R: strange characters