I would like to add one additional comment. In current sources the jdbc
driver detects (through a hack) that the server doesn't have multibyte
enabled and then ignores the SQL_ASCII return value and defaults to the
JVM's character set instead of using SQL_ASCII.
The problem boils down to the fact that without multibyte enabled, the
server has know way of specifiying which 8bit character set is being
used for a particular database. Thus a client like JDBC doesn't know
what character set to use when converting to UNICODE. Thus the best we
can do in JDBC is use our best guess (JVM character set is probably the
best default), and allow the user to explicitly specify something else
Rene Pijlman wrote:
> [forwarding to pgsql-hackers and Bruce as Todo list maintainer,
> see comment below]
> [insert with JDBC converts Latin-1 umlaut to ?]
> On 04 Sep 2001 09:54:27 -0400, Dave Cramer wrote:
>>You have to set the encoding when you make the connection.
>>Properties props = new Properties();
>>Connection con = DriverManager.getConnection(url,props);
>>where encoding is the proper encoding for your database
> For completeness, I quote the answer Barry Lind gave yesterday.
> "[the driver] asks the server what character set is being used
> for the database. Unfortunatly the server only knows about
> character sets if multibyte support is compiled in. If the
> server is compiled without multibyte, then it always reports to
> the client that the character set is SQL_ASCII (where SQL_ASCII
> is 7bit ascii). Thus if you don't have multibyte enabled on the
> server you can't support 8bit characters through the jdbc
> driver, unless you specifically tell the connection what
> character set to use (i.e. override the default obtained from
> the server)."
> This really is confusing and I think PostgreSQL should be able
> to support single byte encoding conversions without enabling
> To the very least there should be a --enable-encoding-conversion
> or something similar, even if it just enables the current
> multibyte support.
> Bruce, can this be put on the TODO list one way or the other?
> This problem has appeared 4 times in two months or so on the
> JDBC list.
> René Pijlman <rene(at)lab(dot)applinet(dot)nl>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
In response to
pgsql-hackers by date
|Next:||From: Tom Lane||Date: 2001-09-04 18:24:16|
|Subject: Re: Bad behaviour when inserting unspecified variable length datatypes |
|Previous:||From: Bruce Momjian||Date: 2001-09-04 17:34:37|
|Subject: Re: Bytea/Base64 encoders for libpq - interested?|
pgsql-jdbc by date
|Next:||From: Liam Stewart||Date: 2001-09-04 18:13:26|
|Subject: driver source code indentation|
|Previous:||From: chris markiewicz||Date: 2001-09-04 17:39:36|
|Subject: Re: error - NOTICE: current transaction...MORE DETAIL...|