Hi all, I have been struggling to get MySql to accept Unicode characters for a while now with no success. I am attaching a small example program as well as a mySql dump in hopes that someone can help.
The expected behavior is that the program should insert a curly quote and a 'one quarter' symbol. It gets the 'one quarter' symbol, but not the curly quote (unicode char 201C). Any help much appreciated. MySql version - 4.1.4-gamma-nt-log Connecto/J version - 3.0.10 table dump: ---------------------------------------- use testchar; DROP TABLE IF EXISTS `testchar`; CREATE TABLE `testchar` ( `testchar` varchar(100) NOT NULL default '' ) ENGINE=MyISAM DEFAULT CHARSET=utf8; ---------------------------------------- test code snippet: ---------------------------------------- try { Class.forName("org.gjt.mm.mysql.Driver"); Connection conn = DriverManager.getConnection( "jdbc:mysql://localhost/testchar?user=root&useUnicode=true&character Encoding=utf8"); java.sql.Statement select = conn.createStatement(); select.executeUpdate("insert into testchar (testchar) values ('problem characters - \u201C ... \u00BC')"); ResultSet r = select.executeQuery("select testchar from testchar"); while (r.next()) { System.out.println(r.getString(1)); } conn.close(); } catch (Exception e) { e.printStackTrace(); } ----------------------------------------- The output should be: problem characters - " ... ¼ Instead, it is: problem characters - ? ... ¼ Many MANY grateful thanks to anyone who can tell me what I am doing wrong. This has been very frustrating. Gregg