Re: MSSQL to PostgreSQL : Encoding problem

From: Tony Caduto <tony_caduto(at)amsoftwaredesign(dot)com>
To: Arnaud Lesauvage <thewild(at)freesurf(dot)fr>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: MSSQL to PostgreSQL : Encoding problem
Date: 2006-11-22 14:32:20
Message-ID: 45645F74.903@amsoftwaredesign.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tino Wildenhain 2006-11-22 14:33:41 Re: URL Decoding
Previous Message Alvaro Herrera 2006-11-22 14:14:04 Re: MSSQL to PostgreSQL : Encoding problem