Re: Using psql -f to load a UTF8 file

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: Leif Biberg Kristensen <leif(at)solumslekt(dot)org>
Cc: Alan Millington <admillington(at)yahoo(dot)co(dot)uk>, Postgres general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: Using psql -f to load a UTF8 file
Date: 2012-09-20 17:53:07
Message-ID: 505B5803.7050106@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 09/20/2012 10:44 AM, Leif Biberg Kristensen wrote:
> Torsdag 20. september 2012 19.27.22 skrev Alan Millington :
>> Thank you for the link. I am using Notepad, which inserts the byte order
>> mark. Following the links a bit further, I gather that the version of
>> Notepad that I am using may not identify a UTF8 file correctly if the byte
>> order mark is omitted. Also, as I mentioned, Python makes use of it. (From
>> the Python documentation on Encoding declarations: "If the first bytes of
>> the file are the UTF-8 byte-order mark ('\xef\xbb\xbf'), the declared file
>> encoding is UTF-8 (this is supported, among others, by Microsoft’s
>> Notepad).")
>> The conclusion seems to be that I must use one editor for Python, and
>> another for Postgres.

I would strongly advise against using Notepad for any kind of text
editing. Wordpad works better, or even better yet Notepad ++:

http://notepad-plus-plus.org/

>
> It's been a long time since I last wrote a Python script, but I've always used
> the explicit encoding directive:
>
> #! /usr/bin/env python
> # -*- encoding: utf-8 -*-
>
> See http://docs.python.org/release/2.5.1/ref/encodings.html which also
> mentions the BOM method as an alternative.
>
> regards, Leif
>
>

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2012-09-20 18:33:09 Re: Using psql -f to load a UTF8 file
Previous Message Leif Biberg Kristensen 2012-09-20 17:44:01 Re: Using psql -f to load a UTF8 file