Re: Current JDBC Driver char encoding - Bug or feature? - Mailing list pgsql-general

From Barry Lind
Subject Re: Current JDBC Driver char encoding - Bug or feature?
Date
Msg-id 3C0673CC.20206@xythos.com
Whole thread Raw
In response to Current JDBC Driver char encoding - Bug or feature?  (Jan Wessely <jawe@vknn.org>)
List pgsql-general
Jan,

You have three options:

1) Enable multibyte on your server and create your database with the
encoding that your data is in (i.e. if you are storing Latin1 characters
you should create your database with the Latin1 encoding).

2) In your jdbc connection URL specify explicitly the encoding you want
the jdbc driver to use.  (i.e. add ?charSet=XXX to the end of the URL, I
don't recal if this takes the postgres encoding names, or the java ones)

3) Use the latest driver from 7.2.

The problem is that the 7.1 driver started to use the encoding that the
database specified the database was created in, to do conversions.
Unfortunately if the server isn't built with multibyte enabled it always
reports the database encoding as SQL_ASCII.  SQL_ASCII is 7bit ascii.
Thus any 8bit characters are converted to ?s.

thanks,
--Barry


Jan Wessely wrote:

> Hello Postgres & JDBC gurus,
>
> We recently upgraded from jdbc7.0-1.2.jar to jdbc7.1-1.2.jar and now non-
> ASCII characters display as ?. That was not the case with the old driver.
>
> Our Postgres Installation was built with --enable-locale but not with
> --enable-multibyte or anything else differing from the default config.
>
> psql displays that characters correctly when printing query results.
>
> Any hints what we can do about this?
>
> Can't imagine that I have to reconfigure the backend when the JDBC driver
> changes.
> We can't fall back to the old driver because of various other bugs or
> unimplemented methods there.
>
> Please forgive if that issue was discussed already, I really tried to
> find related messages, but...
>
> TIA, jan
>
> --
> Jan Wessely
> Vienna Knowledge Net
> mailto:jawe@vknn.org
> http://www.vknn.org
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
>



pgsql-general by date:

Previous
From: Jason Earl
Date:
Subject: Re: Licensing
Next
From: Eugene Bregman
Date:
Subject: libpq in a multithreaded environment