I'm making a web application with JavaScript. I'm using java servlet which is connected with MySQL database with hibernate. in Servlet there is a String in Chinese, and when I try to write that string into MySQL field it shows up as "?" in MySQL. my whole project in netbeans is set to charset=UTF-8. I tried to set collation and charset in database to utf-8, utf8mb4, big5 and none of them works. I also tried to change my column from varchar to nvarchar but when I click apply (MySQL workbench) the column is still "varchar".
this is my servlet
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("application/json");
String tabla=request.getParameter("tabla");
//String tabla contains chinese caracters
String user=request.getParameter("user");
Configuration myConf = new Configuration();
myConf.configure("hib/hibernate.cfg.xml");
StandardServiceRegistry service = new StandardServiceRegistryBuilder().
applySettings(myConf.getProperties()).build();
SessionFactory myFactory = myConf.buildSessionFactory(service);
Session conn = myFactory.openSession();
Transaction t = conn.beginTransaction();
List<User>upislista;
upislista=conn.createQuery("SELECT u FROM User u WHERE useUsername='"+user+"'").list();
upislista.get(0).setUseKineski(tabla);
t.commit();
conn.close();