pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedPostgreSQL JDBC Driver versus Encoding
3+ messages / 3 participants
[nested] [flat]
* PostgreSQL JDBC Driver versus Encoding
@ 2007-10-19 22:43 João Paulo Pires <Joao.Pires@iscte.pt>
2007-10-20 00:18 ` Re: PostgreSQL JDBC Driver versus Encoding John R Pierce <pierce@hogranch.com>
2007-10-20 00:21 ` Re: PostgreSQL JDBC Driver versus Encoding Oliver Jowett <oliver@opencloud.com>
0 siblings, 2 replies; 3+ messages in thread
From: João Paulo Pires @ 2007-10-19 22:43 UTC (permalink / raw)
To: pgsql-jdbc
Hello,
I have a PostgreSQL database which encoding is SQL_ASCII.
I inserted information into that database from a MySQL database, using Java
code, which encoding is UTF-8, and the information in the destination
database has some strange characters related with encoding problems.
There is any additional parameter that we can consider in the PostrgreSQL
connection string to deal with those problems?
The problem should be related with the encoding used to connect to MySQL
database?
Best regards,
João Paulo Pires
Developer
Attachments:
smime.p7s (application/x-pkcs7-signature, 2.9K) download
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: PostgreSQL JDBC Driver versus Encoding
2007-10-19 22:43 PostgreSQL JDBC Driver versus Encoding João Paulo Pires <Joao.Pires@iscte.pt>
@ 2007-10-20 00:18 ` John R Pierce <pierce@hogranch.com>
1 sibling, 0 replies; 3+ messages in thread
From: John R Pierce @ 2007-10-20 00:18 UTC (permalink / raw)
To: Joao.Pires@iscte.pt; +Cc: pgsql-jdbc
João Paulo Pires wrote:
>
> Hello,
>
>
>
> I have a PostgreSQL database which encoding is SQL_ASCII.
>
> I inserted information into that database from a MySQL database, using
> Java code, which encoding is UTF-8, and the information in the
> destination database has some strange characters related with encoding
> problems.
>
>
>
> There is any additional parameter that we can consider in the
> PostrgreSQL connection string to deal with those problems?
>
> The problem should be related with the encoding used to connect to
> MySQL database?
>
>
>
you can't encode all symbols in UTF-8 with simple ASCII. Symbols that
are the same will translate but ASCII only has 200 or so glyphs. you'll
need to convert the database to UTF-8, then redo your inserts.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: PostgreSQL JDBC Driver versus Encoding
2007-10-19 22:43 PostgreSQL JDBC Driver versus Encoding João Paulo Pires <Joao.Pires@iscte.pt>
@ 2007-10-20 00:21 ` Oliver Jowett <oliver@opencloud.com>
1 sibling, 0 replies; 3+ messages in thread
From: Oliver Jowett @ 2007-10-20 00:21 UTC (permalink / raw)
To: Joao.Pires@iscte.pt; +Cc: pgsql-jdbc
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
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2007-10-20 00:21 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-10-19 22:43 PostgreSQL JDBC Driver versus Encoding João Paulo Pires <Joao.Pires@iscte.pt>
2007-10-20 00:18 ` John R Pierce <pierce@hogranch.com>
2007-10-20 00:21 ` Oliver Jowett <oliver@opencloud.com>
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