This week's book giveaway is in the OCP forum.
We're giving away four copies of OCP Java SE 8 Programmer II Exam Study Guide and have Kathy Sierra, Bert Bates, & Elizabeth Robson on-line!
See this thread for details.
Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problems retrieving utf8 encoded fields from mysql database  RSS feed

 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I currently have some fields in tables in the mysql database defined with the "collation utf8 default" for internationalisation. I currently retrieve my data from the database using prepared statements ie resultsets ,for example
rs being ResultSet but when I retrieve the utf8 fields, they return ??? instead of the utf-8 field I require. Any idea where is the best place to set this encoding, is it within the resultset itself when I'm retrieving and how do I go about this? The fields in the database tables are set correctly. Thanks in advance.
 
Sheriff
Posts: 23451
46
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you know they return question marks?
 
Sheriff
Posts: 21289
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're printing these values to System.out, you must know that the Windows Command Prompt and quite a lot of Unix shells have problems with characters that aren't basic / extended Latin (in other words, with a char value of <= 255).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!