Thread: Re: [pgadmin-hackers] Multibyte ODBC

Re: [pgadmin-hackers] Multibyte ODBC

From
Dave Page
Date:

> -----Original Message-----
> From: Jean-Michel POURE [mailto:jm.poure@freesurf.fr]
> Sent: 28 February 2002 07:09
> To: Dave Page
> Cc: 'Hiroshi Inoue'; pgadmin-hackers@postgresql.org;
> pgsql-odbc@postgresql.org
> Subject: Re: [pgadmin-hackers] [ODBC] Multibyte ODBC
>
>
> Dear Dave,
>
> UTF-8 / AccessXP Japanese problem :
>
> - Try import the linked dobc table into an Access table. Can
> you display the
> Japanese glyphs?

No, the data is identical to that in the linked table. Which is also
identical to what I see in IE if I take the <meta http-equiv="content-type"
content="text/html;charset=utf-8"> out of the html file, but then it would
be I suppose.

> Did you write you could also display the glyphs when
> copying/pasting into a table?

Yes, and that's what I think is important. If I copy and paste the Japanese
glyphs from an HTML document displayed in IE6, into an native Access table,
it works perfectly which is why I am not convinced Access or Windows is at
fault here.

> - If AccessXP can display the data from its tables and not
> from ODBC, it may
> be because some "header" information are needed in the ODBC
> stream (example :
> invisible characters at the beginning of file).
>
> This idea comes to me because in HTML, you need to tell the
> browser to switch
> to UTF-8 display (in header information), otherwize IE5 is
> not smart enought
> to understand the ASCII characters are plain UTF-8. Maybe
> AccessXP is like
> IE5... But I may be wrong...

Hmm, I may be *way* of the mark with this one but (from the Microsoft ODBC
Programmers Reference):

----
A Unicode driver must export SQLConnectW in order to be recognized as a
Unicode driver by the Driver Manager.

A Unicode driver must accept Unicode functions (with a suffix of W) and
store Unicode data. It can also accept ANSI functions, but is not required
to. (The Driver Manager does not pass an ANSI function call with the A
suffix to the driver, but converts it to an ANSI function call without the
suffix and then passes it to the driver.)
----

The psqlODBC driver doesn't export *any* W functions in it's .def.

So, could this be the problem? Access XP wants Unicode, but the driver is
only providing it with UTF-8 encoded data (ie, multibyte data encoded into
ASCII)?

Regards, Dave.


Re: [pgadmin-hackers] Multibyte ODBC

From
Jean-Michel POURE
Date:
A very interesting article can be found at :
http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8

> The psqlODBC driver doesn't export *any* W functions in it's .def.

I guess W stand for "Wide" character. W functions are for UCS-2 and UTF-16
data. Are W functions also needed for UTF-8 data? I doubt they are.

> So, could this be the problem? Access XP wants Unicode, but the driver is
> only providing it with UTF-8 encoded data (ie, multibyte data encoded into
> ASCII)?

Basically speaking, UTF-8 data is Unicode data encoded into ASCII. Therefore,
it is hard for any program to detect UTF-8 encoding.

Using OpenOffice, I can view UTF-8 ODBC data. $M Access might simply not
switch to UTF-8. So the question is: how do we tell Access2K that the
attached tables are UTF-8 and not plain ASCII.

In access, tables can be attached unsing VBA. There must be something like an
encoding setting in Access XP VBA.

Cheers,
Jean-Michel POURE

Re: [pgadmin-hackers] Multibyte ODBC

From
Hiroshi Inoue
Date:
Dave Page wrote:
>
> The psqlODBC driver doesn't export *any* W functions in it's .def.
>
> So, could this be the problem? Access XP wants Unicode, but the driver is
> only providing it with UTF-8 encoded data (ie, multibyte data encoded into
> ASCII)?

OK I put a trial driver on http://w2422.nsk.ne.jp/~inoue/
(psqlodbc30W.zip). Note that it's another driver and you
have to register the driver newly. The name of the dll is
psqlodbc30.dll. Create new DSNs for the driver and test it.
Also note that you have to set the client_encoding to UTF-8
using the Connect Settings option.

regards,
Hiroshi Inoue

Re: [pgadmin-hackers] Multibyte ODBC

From
Jean-Michel POURE
Date:
Le Vendredi 1 Mars 2002 10:18, Hiroshi Inoue a ?crit :
> I was able to handle(select/update) Japanase data
> using Access with the driver. There was a problem
> with VB+ADO but I fixed the bug and just replaced
> the driver on my web site

Dear Hiroshi,

Thank you so much for this update. This is a real plus for Unicode users.

Do you think this should also enable pgAdmin2 to display SJIS data provided
we set client_encoding to 'SJIS'?

Best regards,
Jean-Michel