Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

MySQL Characterset

  Asked By: Dale    Date: Dec 29    Category: Java    Views: 1532

i developed a web base application with Java
technology such as JSP, Servlet and use MySQL 4.0 as
DBMS and Hibernate. because i must deploy this
application to UNIX machine and the main language is
Persian, i use UTF-8 character set. now, when i Insert
some the to DB and then retrieve them just see some
question mark. on the other hand each web host that i
found support MySql 4.0.x please help me to resolve
this problem.



3 Answers Found

Answer #1    Answered By: Jennifer Davis     Answered On: Dec 29

Try using encodings such as cp1256 (windows-1256) instead of UTF-8. It may soleve your problem

Answer #2    Answered By: Beaudi Smith     Answered On: Dec 29

When you connnect to DB, must set  some attributes to your connection.
this problem  is DB problem, in store and retriving data in/out it.
but also you must you UTF-8 as your encoding in your jsp  pages.
reffer to MySql documentation to see how you can do that.

Answer #3    Answered By: Sophia Campbell     Answered On: Dec 29

You should have these tasks done to get mysql  UTF8 characterset to work:

- you should set  the table character  set to Unicode

- Set characterset parameter in you jdbc connection parameters to Unicode

- configure mysql to recognize Unicode through its main  config file (In linux it is at /etc/my.cfg may be it’s the same in Unix env)

- Add UTF8 as your jsp  file’s encoding through both jsp <%@page %> directive and HTML <meta> tags.

- Save your JSP files in UT8 encoding.

- In some browsers like IE the character encoding is not set when sending requests you should call the following method before any request.getParameter(…) call

Didn't find what you were looking for? Find more on MySQL Characterset Or get search suggestion and latest updates.