Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Interfaces Jdbc > Character Encod...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 7 Topic 1921 of 1997
Post > Topic >>

Character Encoding problem

by antony.baxter@[EMAIL PROTECTED] ("antony baxter") Apr 7, 2008 at 08:29 AM

Hi,

I'm having a character set problem, and I wonder if anyone here could
sanity check what I'm doing. It might well be that the problem lies
elsewhere.

My database was created with -E UNICODE, and when I do a \l in psql it
is listed as UTF8.

My Java application is receiving data over a socket which is encoded
in UTF8. I'm logging this and it is displaying e.g. Cyrillic or Greek
correctly (using OSX Terminal.app which sup****ts UTF8, tailing the log
with 'less' and the environment variable LESSCHARSET=utf-8.

I'm persisting this data using the latest 8.3 JDBC drivers into
PostgreSQL 8.3.0. I'm not changing the client_encoding (I tried, but I
understand that the JDBC drivers set it to UNICODE anyway, and throw
an error if I attempt to change it to anything else). The data writes
fine, and if I then do a SELECT and a resultSet.getString(x) and write
the output to the log, everything still looks fine. I'm therefore
satisfied that Java + JDBC drivers + PostgreSQL are able to write &
read the data fine.  So far so good.

However, if using psql I try to look at the data, it is mangled. If I
try a manual UPDATE via psql using the data cut'n'pasted from my log,
and then look at the data, it reads correctly. Therefore I know that
psql is capable of reading and writing UTF8 data correctly. Also, the
client application that reads from my database is Perl, and this also
retrieves mangled data; we've tried writing and reading directly from
Perl, and in this case reviewing the data in psql looks normal.

The conclusion I've reached is that Java + JDBC is not actually
persisting the data in UTF-8; is that correct or am I wildly off base,
and if it is correct then is there anything I can do about it?!

Many thanks,

Ant.

-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
 




 7 Posts in Topic:
Character Encoding problem
antony.baxter@[EMAIL PROT  2008-04-07 08:29:47 
Re: Character Encoding problem
antony.baxter@[EMAIL PROT  2008-04-07 09:04:01 
Re: Character Encoding problem
craig@[EMAIL PROTECTED]   2008-04-07 11:48:54 
Re: Character Encoding problem
craig@[EMAIL PROTECTED]   2008-04-07 12:34:44 
Re: Character Encoding problem
craig@[EMAIL PROTECTED]   2008-04-07 12:36:56 
Re: Character Encoding problem
craig@[EMAIL PROTECTED]   2008-04-07 11:38:58 
Re: Character Encoding problem
craig@[EMAIL PROTECTED]   2008-04-07 12:35:37 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Thu Jul 24 2:02:50 CDT 2008.