From: Oliver Jowett <oliver@opencloud.com>
To: Joao.Pires@iscte.pt
Cc: pgsql-jdbc@postgresql.org
Subject: Re: PostgreSQL JDBC Driver versus Encoding
Date: Sat, 20 Oct 2007 13:21:13 +1300
Message-ID: <471949F9.8020304@opencloud.com> (raw)
In-Reply-To: <004301c812a1$7a8ee980$dc4c0a0a@ci.iscte.intranet>
References: <004301c812a1$7a8ee980$dc4c0a0a@ci.iscte.intranet>
João Paulo Pires wrote:
> I have a PostgreSQL database which encoding is SQL_ASCII.
This is the cause of your problem. SQL_ASCII provides essentially no
encoding information at all, so the JDBC driver does not know how to
translate between the database and Java's internal UTF-16
representation. If you are going to be inserting anything other than
7-bit-ASCII text into it, you are going to have problems.
If you can, try using a database encoding that can represent the data
you are inserting. UTF8 / UNICODE is probably a good choice unless you
have special requirements. See
http://www.postgresql.org/docs/8.2/static/multibyte.html especially the
bit that says:
> The SQL_ASCII setting behaves considerably differently from the other settings. When the server character set is SQL_ASCII, the server interprets byte values 0-127 according to the ASCII standard, while byte values 128-255 are taken as uninterpreted characters. No encoding conversion will be done when the setting is SQL_ASCII. Thus, this setting is not so much a declaration that a specific encoding is in use, as a declaration of ignorance about the encoding. In most cases, if you are working with any non-ASCII data, it is unwise to use the SQL_ASCII setting, because PostgreSQL will be unable to help you by converting or validating non-ASCII characters.
-O
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: oliver@opencloud.com, Joao.Pires@iscte.pt
Subject: Re: PostgreSQL JDBC Driver versus Encoding
In-Reply-To: <471949F9.8020304@opencloud.com>
References: <004301c812a1$7a8ee980$dc4c0a0a@ci.iscte.intranet> <471949F9.8020304@opencloud.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox