Arabic encoding in Java Studio Creator
I'm using Java Studio Creator with a MySQL dataBase to build my new small system..
When I pass Arabic characters from the browser to the MySQL database, they appear as question marks, ???
, in MySQL database.
I check the encoding in the JSP code, it looks like the following.
<?xml version="1.0" encoding="UTF-8"?>
<jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:ui="http://www.sun.com/web/ui">
<jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
That means it's UTF-8.
I tried encoding like Windows-1256 (code page used to write Arabic), but it gave me strange symbols, not question marks.
Someone here, called "Rashad", suggested t开发者_运维问答o use something called Servletrequest, but I don't know where to put it. And what does Got, Post mean to solve this problem?
For MySQL you need to specify the encoding in the JDBC URL.
So, you should not use this JDBC URL syntax:
jdbc:mysql://localhost:3306/db_name
But you should use this JDBC URL syntax:
jdbc:mysql://localhost:3306/db_name?useUnicode=yes&characterEncoding=UTF-8
精彩评论