0
votes

I do a HTTP GET call in Java to get content which may contain spanish characters, for example: Ñañez

But what I get as a response from Mysql - Ñañez So far I searched online and did the below:

  1. Appended utf-8 as encoding in connection String(Using Java) jdbc:mysql://localhost:3306/dbname?useUnicode=true&characterEncoding=UTF-8

  2. Updated the table's encoding ALTER TABLE test CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;

The problem is still there.. Anything I am missing??

Server is Tomcat 6

3
How does the result look when you execute the query directly against the SQL server using an SQL client?hovanessyan

3 Answers

0
votes

try altering table column

ALTER TABLE `test` CHANGE `columnname` `columnname` VARCHAR(200) 
    CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL; 
0
votes

you must run this query before your insert query in mysql:

SET NAMES 'utf8'
0
votes

Mojibake is usually caused by

  • The bytes you have in the client are correctly encoded in utf8 (good).
  • You connected with SET NAMES latin1 (or set_charset('latin1') or ...), probably by default. (It should have been utf8.)
  • The column in the tables may or may not have been CHARACTER SET utf8, but it should have been that.

Include characterEncoding=utf-8 in the connection string.