RE: [JDBC] Re: Reading £ character from DB is displaying œ character

Поиск
Список
Период
Сортировка
Искать
От
Hudson, Derrick
Тема
RE: [JDBC] Re: Reading £ character from DB is displaying œ character
Дата
Msg-id
401084E5E73F4241A44F3C9E6FD79428A70C62C7@exch-01
Ответ на
Список
Дерево обсуждения
Reading £ character from DB is displaying œ character saisantoshi <mr@starsborn.com>
RE: [JDBC] Reading £ character from DB is displaying œ character Jim Garrison <jim.garrison@nwea.org>
RE: Reading £ character from DB is displaying œ character saisantoshi <mr@starsborn.com>
Re: Reading £ character from DB is displaying œ character John R Pierce <pierce@hogranch.com>
Re: Reading £ character from DB is displaying œ character saisantoshi <mr@starsborn.com>
Re: Reading £ character from DB is displaying œ character saisantoshi <mr@starsborn.com>
Re: Re: Reading £ character from DB is displaying œ character John R Pierce <pierce@hogranch.com>
Re: Reading £ character from DB is displaying œ character saisantoshi <mr@starsborn.com>
Re: Re: Reading £ character from DB is displaying œ character John R Pierce <pierce@hogranch.com>
Re: Reading £ character from DB is displaying œ character saisantoshi <mr@starsborn.com>
RE: [JDBC] Re: Reading £ character from DB is displaying œ character "Hudson, Derrick" <dhudson@redcom.com>
RE: Re: Reading £ character from DB is displaying œ character saisantoshi <mr@starsborn.com>
Re: [JDBC] Re: Reading £ character from DB is displaying œ character Lachezar Dobrev <l.dobrev@gmail.com>

How do you determine that you "get gibberish characters"?  Are you printing the string, or inspecting the individual characters in memory using a debugger?  The gibberish is probably the result of the way the text is displayed, not a problem with the database or the JDBC.  You need to correctly encode the string as bytes before sending it to System.out.  "correctly" depends on the encoding expected by your terminal (cmd.exe, the console of an IDE, etc.).

This answer on StackOverflow should be helpful;  it is equally applicable to the original question of JSON as it is to your question of JDBC.

http://stackoverflow.com/questions/11868022/unicode-characters-appearing-as-question-marks-in-java-json-parsing/11868911#11868911




-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of saisantoshi
Sent: Tuesday, September 24, 2013 12:52 AM
To: pgsql-jdbc@postgresql.org
Subject: [JDBC] Re: Reading £ character from DB is displaying œ character

Here is what I get:

testdb=> set client_encoding='DOS437';
ERROR:  invalid value for parameter "client_encoding": "DOS437"
testdb=> set client_encoding='CP437';
ERROR:  invalid value for parameter "client_encoding": "CP437"

The other question I have is if I am setting the server_encoding/client_encodng to UTF8, then saving the £ character into DB should save £ and be able to see the same in the table. I am still not clear as to why it gets gibbersh characters... its much confusing as to believe if it saved the right characters. Not sure what's missing peice here??



В списке pgsql-jdbc по дате отправления
От: saisantoshi
Дата:
От: Jim Garrison
Дата:
FAQ