Reading £ character from DB is displaying œ character - Mailing list pgsql-jdbc

From saisantoshi
Subject Reading £ character from DB is displaying œ character
Date
Msg-id 1379825582068-5771897.post@n5.nabble.com
Whole thread Raw
Responses RE: [JDBC] Reading £ character from DB is displaying œ character
List 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.


pgsql-jdbc by date:

Previous
From: Kevin Grittner
Date:
Subject: Re: Cannot commit when autoCommit is enabled error
Next
From: Jim Garrison
Date:
Subject: RE: [JDBC] Reading £ character from DB is displaying œ character