encoding converting from ascii to unicode

From: "Joel Fradkin" <jfradkin(at)wazagua(dot)com>
To: <pgsql-admin(at)postgresql(dot)org>
Subject: encoding converting from ascii to unicode
Date: 2005-07-01 13:09:29
Message-ID: 000001c57e3e$1e0d2fe0$797ba8c0@jfradkin
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-odbc

I have been trying to get unicode to work for us (we moved from MSSQL and
had to initially use ascii because it would blow up writing the French chars
when I built my data base).

I have a .net app that reads my tables and does insert statements into a
Unicode database.

The actual conversion is being done with this code:

Dim ascii As Encoding = Encoding.ASCII

Dim [unicode] As Encoding = Encoding.Unicode

' Convert the string into a byte[].

Dim asciiBytes As Byte() = ascii.GetBytes(asciiString)

' Perform the conversion from one encoding to the other.

Dim unicodeBytes As Byte() = Encoding.Convert(ascii, [unicode],
asciiBytes)

sqltounicode = [unicode].GetString(unicodeBytes)

So read in ascii and have :

Dim cnnunicode As New NpgsqlConnection("Server=" + TextBoxunicodeserver.Text
+ ";Port=5432;User Id=postgres;Password=;Database=" +
TextBoxunicodedbname.Text + ";Encoding=UNICODE;")

To open up my Unicode connection that I use for writing.

If I observe the string using the debugger it looks like French when I read
it from the ascii database.

If I do not convert it, it gives a byte sequence error, If I run the
conversion above the French turns into question marks.

I am sorry for asking this so many times, but what do I have to do to get
the French to look like French and in the Unicode database.

One of my goals is to be able to use the 8.0 odbc drivers which return
question marks for French chars (the 7.4 odbc driver does not turn them into
question marks it reads the French ascii ok).

Any help is much appreciated.

Joel Fradkin

Wazagua, Inc.
2520 Trailmate Dr
Sarasota, Florida 34243
Tel. 941-753-7111 ext 305

jfradkin(at)wazagua(dot)com
www.wazagua.com
Powered by Wazagua
Providing you with the latest Web-based technology & advanced tools.
C 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, Inc
This email message is for the use of the intended recipient(s) and may
contain confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and delete and destroy
all copies of the original message, including attachments.

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Mike.Samson 2005-07-01 13:30:50 database size after a DELETE and VACUUM
Previous Message jehan procaccia 2005-07-01 09:07:06 Re: restore database from bare files

Browse pgsql-odbc by date

  From Date Subject
Next Message Joel Fradkin 2005-07-01 18:30:11 Re: encoding converting from ascii to unicode (I got it
Previous Message Joel Fradkin 2005-07-01 12:44:44 What to do about errors returned by odbc