I have the following when I do this command in MYSQL Browser
'character_set_client', 'utf8'
'character_set_connection', 'utf8'
'character_set_database', 'utf8'
'character_set_filesystem', 'binary'
'character_set_results', 'utf8'
'character_set_server', 'utf8'
'character_set_system', 'utf8'
'character_sets_dir', '/usr/share/mysql/charsets/'
But when I call something like this to my servlet it saves as gibberish
http://something.com/TestServlet/test?cmd=1&id=999&content=%E6%90%9C%E7%8B%97%E6%90%9C
The characters at the end are chinese characters.
I have this code in my servlet to get the content as UTF8
OutputStream ostream = response.getOutputStream();
PrintStream out = new PrintStream(ostream, true, "UTF8");
String content = request.getParameter("content");
Then I call an insert on the database something like db.insert(content); This is just pseudo of course.
I even added ?useUnicode=true&characterEncoding=UTF-8 to my connection string but to no avail.
搜狗搜 is displayed as æçæ in mysql query browser
The problem was with the tomcat side had to add a URI-Encoding=UTF-8 to the connection in the server.xml.