Re: Java String saving as unicode in database

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Java String saving as unicode in database
Date: 2013-10-13 00:38:21
Message-ID: 5259EB7D.9000004@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On 10/12/2013 4:55 PM, saisantoshi wrote:
> I tried this but the problem is its not saving in the DB as what I wanted to
> store..
> *Sample\u0020\u0061\u0074\u0020\u0032\u0032\u0042\u0020 text
>
> Its converting the above and storing it in the DB. When I look at the
> database, it is something that I can't understand looking at it. May be its
> an editor problem. How do I view the exact string stored from my windows cmd
> prompt connecting to postgres sql.

Java (and microsoft windows) uses UCS16, while SQL (and unix/linux and
the internet and about everything else) uses UTF8 (but only if its so
configured). with SQL, you have two things, the database encoding, and
the client_encoding, the latter can be changed on the fly, while the
former is setup when the database is initialized and created.

--
john r pierce 37N 122W
somewhere on the middle of the left coast

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message dmp 2013-10-13 16:46:16 Re: Java String saving as unicode in database
Previous Message saisantoshi 2013-10-12 23:55:10 Re: Java String saving as unicode in database