From: | Jim Garrison <jim(dot)garrison(at)nwea(dot)org> |
---|---|
To: | "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | RE: [JDBC] Reading £ character from DB is displaying œ character |
Date: | 2013-09-23 17:04:22 |
Message-ID: | 0C723FEB5B4E5642B25B451BA57E27303EE04617@S1P5DAG3C.EXCHPROD.USA.NET |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
> -----Original Message-----
> 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&characterEnco
> ding=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
What is the OS? What software is *displaying* the output? Is it an IDE? A terminal? If the terminal isn't UTF-8 capable, or there's some output encoding going on you could have perfectly valid data in the resultset and see it corrupted on output to the console.
From | Date | Subject | |
---|---|---|---|
Next Message | saisantoshi | 2013-09-23 18:33:18 | RE: Reading £ character from DB is displaying œ character |
Previous Message | saisantoshi | 2013-09-22 04:53:02 | Reading £ character from DB is displaying œ character |