pg.ddx.io pgsql-odbc@postgresql.org mailing list archive
help / color / mirror / Atom feedUnicode support
32+ messages / 10 participants
[nested] [flat]
* Unicode support
@ 2002-02-03 20:26 Nhan Ngo Dinh <nngodinh@tiscali.it>
0 siblings, 1 reply; 32+ messages in thread
From: Nhan Ngo Dinh @ 2002-02-03 20:26 UTC (permalink / raw)
To: pgsql-odbc
Greetings,
I've been searching for long time for the way to convert a Microsoft SQL
7.0 database into a database such as MySQL or PostgreSQL. The problem is
that this database contains tables with both LATIN1 characters (English,
French) and Arabic characters, so the only way to put all together is to
use an unicode charset such as UTF-8.
PostgreSQL does support unicode characters (at least the documents say
that) while MySQL doesn't. I enabled the multibyte support while compiling
sources on a Linux platform and tried some ways to transfer the original
database.
First of all, I tried using the PostgreSQL ODBC driver. I've exported the
database to Microsoft Access to better handle the situation and I've
installed the PostgreSQL ODBC driver taken from ftp.postgresql.org (version
7.01.00.09). I've transferred a sample table containing both charsets and
the result was that Arabic letters were replaced into the target PostgreSQL
database by "?" characters.
In the psqlodbc_*.log files the Arabic entries were already replaced with
quotation marks.
Then I tried many other methods, using pgAdmin II, or even trying to
synchronize the databases with a PHP script that used the freetds library
(first) or the Sybase library (then) to directly access the MSSQL database.
The imported Arabic fields were always quotation marks, because the unicode
support was not fully enabled into both sybase libraries.
The only solution that I've found is to import the database using ODBC in a
PHP script with PHP on a Windows box, converting nvarchar values (with
CONVERT in the query) into varbinary, setting the binary visualization to
hex. So I can parse that string and store unicode strings into the database.
Well, may be there is a better solution directly using the PostgreSQL ODBC
driver.
Any idea?
Thanks.
Nhan NGO DINH
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Unicode support
@ 2002-02-11 17:22 Jean-Michel POURE <jm.poure@freesurf.fr>
parent: Nhan Ngo Dinh <nngodinh@tiscali.it>
0 siblings, 1 reply; 32+ messages in thread
From: Jean-Michel POURE @ 2002-02-11 17:22 UTC (permalink / raw)
To: Nhan Ngo Dinh <nngodinh@tiscali.it>; pgsql-odbc
Le Dimanche 3 Février 2002 21:26, Nhan Ngo Dinh a écrit :
> Any idea?
The only problem is with Arabic, right? Export schema and data separately
from MS SQL Server.
1) Import the schema file in PostgreSQL directly in Latin1.
2) Translate the data file to UFT-8 under Linux using recode or iconv:
- iconv -f arabic_enconding_name -t utf-8 filename.txt
- recode arabic_enconding_name..u8 file_name.txt
A good manual can be found here :
http://www.iro.umontreal.ca/contrib/recode/HTML/recode.html
3) Use pgAdmin2 or pgsql \copy statement to import the file.
Please note that Access2000 and PgAdmin 2 do not support Unicode. This was an
issue for us at pgAdmin Team and the answer is "there is no unicode support
although $M claims there is". You have to wait for Windows ZX 2439, which
will take place in more than 300 years and 134 Windows upgrades. So prepare a
cryogenic place and wait until UTF-8 is added to Access.
On the converse PHP supports unicode very well. Do not hesitate to write me
back for further information.
Cheers,
Jean-Michel POURE
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Unicode support
@ 2002-02-12 00:45 Hiroshi Inoue <Inoue@tpf.co.jp>
parent: Jean-Michel POURE <jm.poure@freesurf.fr>
0 siblings, 1 reply; 32+ messages in thread
From: Hiroshi Inoue @ 2002-02-12 00:45 UTC (permalink / raw)
To: jm.poure@freesurf.fr; Nhan Ngo Dinh <nngodinh@tiscali.it>; +Cc: pgsql-odbc
Jean-Michel POURE wrote:
>
> Le Dimanche 3 F$BqW(Brier 2002 21:26, Nhan Ngo Dinh a $BqD(Brit :
> > Any idea?
>
> 3) Use pgAdmin2 or pgsql \copy statement to import the file.
>
> Please note that Access2000 and PgAdmin 2 do not support Unicode. This was an
> issue for us at pgAdmin Team and the answer is "there is no unicode support
> although $M claims there is".
If our ODBC driver supports UNICODE (UCS-2 not utf-8)
it would probably be possible for Access2000, PgAdmin
or other VB apps etc to handle UNICODE data via ODBC
(ADO etc) under Windows NT/2000/XP because the OS's
are UNICODE(UCS-2) based. Though it's been on my TODO
list I've had no time to do it unfortunately.
regards,
Hiroshi Inoue
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Unicode support
@ 2002-02-12 09:02 Jean-Michel POURE <jm.poure@freesurf.fr>
parent: Hiroshi Inoue <Inoue@tpf.co.jp>
0 siblings, 0 replies; 32+ messages in thread
From: Jean-Michel POURE @ 2002-02-12 09:02 UTC (permalink / raw)
To: Hiroshi Inoue <Inoue@tpf.co.jp>; Nhan Ngo Dinh <nngodinh@tiscali.it>; +Cc: pgsql-odbc
Le Mardi 12 Février 2002 01:45, Hiroshi Inoue a écrit :
> If our ODBC driver supports UNICODE (UCS-2 not utf-8)
> it would probably be possible for Access2000, PgAdmin
> or other VB apps etc to handle UNICODE data via ODBC
> (ADO etc) under Windows NT/2000/XP because the OS's
> are UNICODE(UCS-2) based. Though it's been on my TODO
> list I've had no time to do it unfortunately.
OK, I understand.
Cheers, Jean-Michel POURE
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: [ODBC] Unicode support
@ 2002-02-18 11:14 Jean-Michel POURE <jm.poure@freesurf.fr>
3 siblings, 0 replies; 32+ messages in thread
From: Jean-Michel POURE @ 2002-02-18 11:14 UTC (permalink / raw)
To: pgadmin-hackers@postgresql.org; pgsql-odbc; +Cc: Nhan NGO DINH <n.ngodinh@tin.it>
Le Lundi 18 Février 2002 11:13, Nhan NGO DINH a écrit :
> Well, you said to export data from the SQL server splitted into structure
> and data. How to do that? I really don't have so much experience with
> Microsoft SQL Server...
>
> Then: I've tried to convert with iconv an UNICODE exported table but I
> don't see the expected results.
What is the encoding of your $MS SQL database? If Unicode, no recoding is
needed.
I recommand you installed pgAdmin2 (http://pgadmi.postgresql.org) and
followed the following steps:
1) Create a Unicode database.
2) Use the migration wizard to import $MS SQL Schema into PostgreSQL. It will
handle type conversion from $MS SQL Server <-> PostgreSQL.
Alternatively, you may use $MS SQL Server GUI to export schema. You will need
to adapt schema types and objects (convert money into float8, sequences,
etc...). This can be quite difficult in a large schema.
Use pgAdmin2 graphical interface to make sure all objects are imported :
keys, sequences, etc.. The best way is to run both GUIs at the same time to
create the missing objects manually.
3) Export the data from SQL Server into a text file using $MS SQL Server GUI.
Alternatively, you can attach files in Access2K and export them into a text
file.
Recode the text file using : recode Latin1..u8 file_name.txt (assuming
Latin1 is the source encoding). If the $MS SQL database is already Unicode,
no recoding is required and you can use pgAdmin2 during the entire process.
4) Import the resulting data into PostgreSQL using pgAdmin2 or pgsql \Copy
statement.
Do not hesitate to write me on pgadmin-hackers@postgresql.org for more
support.
Cheers,
Jean-MIchel POURE
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Unicode support
@ 2002-02-19 07:28 Jean-Michel POURE <jm.poure@freesurf.fr>
3 siblings, 1 reply; 32+ messages in thread
From: Jean-Michel POURE @ 2002-02-19 07:28 UTC (permalink / raw)
To: pgsql-odbc
Ok, I've tried to follow your steps: be sure I've already installed pgadmin
II, that's obviously the best way to intercommunicate with postgresql from
Microsoft platforms.
It was surprising that I've succeeded transferring arabic unicode to
postgresql, at least it seems to have included multibyte characters. Then
I've found two problems:
1) When I try to view tables from Access XP, the arabic letters are not
correctly displayed: I can see only the multibyte to single byte 1:1
conversion. This is not that important because I don't need to see it in
Access because the database will be seen through PHP on the web.
2) The most critical problem is that I cannot convert a table with both
french letters with accents and arabic letters. Pgadmin seems to refuse
french characters. So I've erased french records (at least records with
accents) and the database has been transferred.
As far as I can see the unicode text file from Microsoft SQL Server is not
fully UTF-8 standard, but maybe I'm wrong.
On the postgresql server side there is the message:
ERROR: Invalid UNICODE character sequence found (0xe974e9)
So E9 74 E9 is "été" ("société" field in the 5th record)
To better understand the situation I send you in attachment the unicode TXT
file that I'm trying to import and the pgadmin log.
Thx a lot!
Bye.
At 12.14 18/02/2002 +0100, you wrote:
>Le Lundi 18 Février 2002 11:13, Nhan NGO DINH a écrit :
> > Well, you said to export data from the SQL server splitted into structure
> > and data. How to do that? I really don't have so much experience with
> > Microsoft SQL Server...
> >
> > Then: I've tried to convert with iconv an UNICODE exported table but I
> > don't see the expected results.
>
>What is the encoding of your $MS SQL database? If Unicode, no recoding is
>needed.
>
>I recommand you installed pgAdmin2 (http://pgadmi.postgresql.org) and
>followed the following steps:
>
>1) Create a Unicode database.
>
>2) Use the migration wizard to import $MS SQL Schema into PostgreSQL. It will
>handle type conversion from $MS SQL Server <-> PostgreSQL.
>
>Alternatively, you may use $MS SQL Server GUI to export schema. You will need
>to adapt schema types and objects (convert money into float8, sequences,
>etc...). This can be quite difficult in a large schema.
>
>Use pgAdmin2 graphical interface to make sure all objects are imported :
>keys, sequences, etc.. The best way is to run both GUIs at the same time to
>create the missing objects manually.
>
>3) Export the data from SQL Server into a text file using $MS SQL Server GUI.
>Alternatively, you can attach files in Access2K and export them into a text
>file.
>
>Recode the text file using : recode Latin1..u8 file_name.txt (assuming
>Latin1 is the source encoding). If the $MS SQL database is already Unicode,
>no recoding is required and you can use pgAdmin2 during the entire process.
>
>4) Import the resulting data into PostgreSQL using pgAdmin2 or pgsql \Copy
>statement.
>
>Do not hesitate to write me on pgadmin-hackers@postgresql.org for more
>support.
>
>Cheers,
>Jean-MIchel POURE
>
>---------------------------(end of broadcast)---------------------------
>TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
Attachments:
berytos.txt (text/plain, 1.0K) download
1 6 8 , "