Reading £ character from DB is displaying œ character

From: saisantoshi <mr(at)starsborn(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Reading £ character from DB is displaying œ character
Date: 2013-09-22 04:53:02
Message-ID: 1379825582068-5771897.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi Everyone,

I am trying to read to read a foreign character from database (Get *£*100)
is giving some other character. I am using plain Java- JDBC connection. Just
wondering if there is anything that needs to be done apart from the below?

Below is the pseudo code:

connection = DriverManager.getConnection(

"jdbc:postgresql://127.0.0.1:5432/demodb?useUnicode=yes&characterEncoding=utf-8",
"test",
"test");

String sql = "select * from test_data";
ResultSet rs = stmt.executeQuery(sql);
while(rs.next()){

System.out.println(rs.getString(1)) // Returns Get *œ*100

Expected : Get *£*100)

}

DB is UTF-8
Postgres jar version : postgresql-9.0-801.jdbc4.jar

Appreciate if you could let me know if I am missing anything here?

Thanks,
Sai.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Reading-character-from-DB-is-displaying-character-tp5771897.html
Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com.

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Jim Garrison 2013-09-23 17:04:22 RE: [JDBC] Reading £ character from DB is displaying œ character
Previous Message Kevin Grittner 2013-09-18 18:58:04 Re: Cannot commit when autoCommit is enabled error