0

I made a Dynamic Web Project in Eclipse, using jsp's, servlets, an encoding filter and MySQL as the place to store my db tables.

Whenever I submit a form with Korean/Chinese/Japanese letters it shows up as ???? in the database table.

The problem seems to be with the actual code where I make the connection and execute the query. I don't think the insert statement is encoded in UTF-8, which is why it shows up as question marks.

Is there a file or piece of code I need to modify regarding the JDBC driver in order to store UTF-8 characters in my database?

I have already made sure my jsp files have UTF-8 charset and encoding in the page and meta tags, and put this in my servlets:

request.setCharacterEncoding("UTF-8");
    response.setContentType("text/html;charset=UTF-8");
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
episkeyyy
  • 109
  • 11

1 Answers1

0

Its realy simple to add multi-language in MySQL Workbench, if you got MySQL Workbench, just go to the console, click your database, and look for collation, set it to utf8_general_ci, after that all your data will show correctly.

enter image description here

You can also do this by executing a query : Alter TABLE TABLE_NAME_HERE CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Ali Ben Messaoud
  • 11,690
  • 8
  • 54
  • 87
  • thank you for your time, I had also previously done that :) – episkeyyy Jul 04 '16 at 23:28
  • phpmyadmin isn't used, this question is about MySQL and Java/JDBC. – Mark Rotteveel Jul 05 '16 at 10:10
  • Please check Wikipedia page : phpMyAdmin is a free and open source tool written in PHP intended to handle the administration of MySQL or MariaDB with the use of a web browser. https://en.wikipedia.org/wiki/PhpMyAdmin – Ali Ben Messaoud Jul 05 '16 at 12:50
  • @alibenmessaoud I know, but contrary to the original text, the question is not about phpmyadmin, it is about using MySQL from Java. – Mark Rotteveel Jul 05 '16 at 18:20
  • @MarkRotteveel, Well, the guy uses MySQL and he manages its DB with phpMyAdmin. I saw that you edited the question and removed all terms about phpMyAdmin. Also, see that the person said thanks in the first comment. But the context changed after your had edited the question and so my answer is no longer correct. – Ali Ben Messaoud Jul 06 '16 at 13:39
  • I didn't change the scope: I clarified the question as you cannot connect to phpmyadmin from Java to access a database. – Mark Rotteveel Jul 06 '16 at 14:47