pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Denis BUCHER <dbucherml@hsolutions.ch>
To: Peter Eisentraut <peter_e@gmx.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: Question about encoding
Date: Tue, 25 Aug 2009 22:16:24 +0200
Message-ID: <4A944698.8060908@hsolutions.ch> (raw)
In-Reply-To: <1251153745.29824.19.camel@vanquo.pezone.net>
References: <4A92C305.2020303@hsolutions.ch>
	<1251153745.29824.19.camel@vanquo.pezone.net>

Hello,

Peter Eisentraut a écrit :
>> Question 1 :
>> Is it the expected behavior ? These characters have a SQL_ASCII
>> equivalent because I already have them stored in another table of the
>> same database
> 
> SQL_ASCII is not the same as ASCII.  SQL_ASCII means, take the bytes as
> they come.  So a 40-character UTF-8 string might indeed be longer than
> 40 bytes, which is what SQL_ASCII will look at.
> 
> The best bet is to avoid SQL_ASCII altogether.  It's pretty bogus and
> inconsistent.

OK that's a good point it explains everything.

>> Question 2 :
>> If yes, then I suppose I should have the database as LATIN1 or UTF8.
>> Can I change/convert the encoding of the database ? Or at least of the
>> schema (which would be even better)
> 
> Dump, recreate database with right encoding, restore.

Ok I did it but postgresql 7.4 was not very nice, the following failed :
1. dump
2. DROP DATABASE; CREATE DATABASE WITH ENCODING UTF8
3. restore

And it bugged. In fact the dump was writtent with "SET CLIENT
ENCODING=SQL_ASCII but when restoring on the UTF8 databse it failed, I
had to change it to SET client_encoding = LATIN1.

Anyway, finally everything is working again, I just had to add a SET
NAMES LATIN1 to my application because it was ISO and not UTF8 aware.

Therefore thanks a lot for your help, it solved all my problems !

Denis



view thread (3+ messages)

Message-ID: <4A944698.8060908@hsolutions.ch>
Permalink:  ../4A944698.8060908@hsolutions.ch/
Also on:    postgresql.org/message-id/4A944698.8060908@hsolutions.ch

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dbucherml@hsolutions.ch, peter_e@gmx.net
  Subject: Re: Question about encoding
  In-Reply-To: <4A944698.8060908@hsolutions.ch>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox