• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Problems retrieving utf8 encoded fields from mysql database

 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 28298
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do you know they return question marks?
 
Sheriff
Posts: 22805
131
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Did you ever grow anything in the garden of your mind? - Fred Rogers. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic