Re: Getting adaped output from unicode text, without a connection

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: "Hefferon, James S(dot)" <jhefferon(at)smcvt(dot)edu>
Cc: "psycopg(at)postgresql(dot)org" <psycopg(at)postgresql(dot)org>
Subject: Re: Getting adaped output from unicode text, without a connection
Date: 2013-07-21 20:39:23
Message-ID: 51EC46FB.40107@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On 07/21/2013 11:56 AM, Hefferon, James S. wrote:
> Hello,
>
> I need to write some static .sql files (just as an explanation, it is startup code for Django). Some of the strings are non-ascii. I'm stumped about how to get utf-8 instead of latin-1 in the file.
>
> I'm generating the .sql as strings, without a connection. I found a prior message on this list that suggested what to do (1) and came up with this routine.
>

>
> I expect that I am asking a dopey question (I'm not very sure what I am doing) but I'd appreciate a pointer even if it makes me feel dumb.

My question would be, why invoke psycopg2 at all?
Can you not just write out the strings?

>
> Thanks,
> Jim
>
> (1) http://www.postgresql.org/message-id/AANLkTik+tq8hbnCj3ROmOLNV1DSw48o4sDoSvnxTN3R8@mail.gmail.com
>

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message Christophe Pettus 2013-07-21 23:29:32 Re: Getting adaped output from unicode text, without a connection
Previous Message Daniele Varrazzo 2013-07-21 20:08:20 Re: Getting adaped output from unicode text, without a connection