0

I made a program that is generating me a INSERT queries for a MySql database. The database has 2 fields that are encoded with latin1_swedish_ci charset. If I run the query from PhpMyAdmin when I preview the content with my php script some special char (like "ó", "é"...) is not showed correctly.

I think the problem is that Java is encoding String as utf8 charset so when i copy paste the query in the phpmyadmin and i run it, the inserted record is generated with the wrong charset. How can I generate the correct query (with the correct charset) in Java?

Thanks In advance for your help

Aurelio De Rosa
  • 21,228
  • 8
  • 47
  • 70
ddelizia
  • 1,569
  • 5
  • 30
  • 53
  • Java certainly does it the right way. Test it using a Java program rather than copying the request from the Java program, paste it in your browser, and execute it with phpMyAdmin. Java doesn't do anything in such a test. What makes it fail could be the .java file encoding, a browser problem, a HTTP problem, or a phpMyAdmin problem, but these have nothing to do with Java. – JB Nizet Nov 06 '11 at 11:50
  • 1
    Here are the supported encodings in Java: http://download.oracle.com/javase/1.3/docs/guide/intl/encoding.doc.html Here's how you determine what the default charset is for your string: http://stackoverflow.com/questions/1749064/how-to-find-default-charset-encoding-in-java – Gray Nov 06 '11 at 16:20

0 Answers0