Re: MSSQL to PostgreSQL : Encoding problem

Tony Caduto <tony_caduto@amsoftwaredesign.com>

From: Tony Caduto <tony_caduto@amsoftwaredesign.com>
To: Arnaud Lesauvage <thewild@freesurf.fr>
Cc: pgsql-general@postgresql.org
Date: 2006-11-22T14:32:20Z
Lists: pgsql-general
>
> Of course, but it doesn't work !!!
> Whatever client encoding I choose in postgresql before COPYing, I get 
> the 'invalid byte sequence error'.
>
> The farther I can get is exporting to UNICODE and importing as UTF8. 
> Then COPY only breaks on the euro symbol (otherwise it breaks very 
> early, I think on the first "non-ascii" character).
>
> -- 
Like I said before UNICODE <> UTF8  That's why the COPY command breaks 
on the Euro symbol.
You will have to export as UNICODE, then encode it as UTF8, then you 
won't get the breakage.

UTF8 is simply a means to store UNICODE pretty much as ASCII text.

You could grab a copy of Delphi TurboExplorer and create a import 
routine using the dbGO ADO components and the PG ODBC driver.
Basicly you need to encode any UNICODE data going to the PG server with 
the system.utf8encode function:

[Delphi] function *UTF8Encode*(const WS: WideString): UTF8String;
Call Utf8Encode to convert a Unicode string to UTF-8. WS is the Unicode 
string to convert. Utf8Encode returns the corresponding UTF-8 string.

I would imagine that Perl also has such routines, but I don't know for 
sure. These routines might be in FreePascal as well.

-- 
Tony Caduto
AM Software Design
http://www.amsoftwaredesign.com
Home of PG Lightning Admin for Postgresql
Your best bet for Postgresql Administration