3

I've a SmartGWT application which interacts with a mysql database using rpc services.
Suppose it as a simple form with a textbox & two save & load buttons.
My database & tables & all fields collation is utf8_persian_ci.
All java source files & module html & xml files have saved with utf8 character set. & also I've a meta tag in module html file which contains my form :

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

my application works correctly in eclipse develpment mode & also in my local tomcat server. Then i put it on remote server (I compress it using jar.exe into a war file with -cvf flag & then upload it using my server's plesk control panel).
In this mode, when I load data from a mysql table (load a record from any table), data will load into my form with no problem, but when I want to save some data (in persian language), mysql just writes some ? (question sign) in characteristic table fields.

Any idea ?

Igor Klimer
  • 15,321
  • 3
  • 47
  • 57
Ehsan Khodarahmi
  • 4,772
  • 10
  • 60
  • 87

1 Answers1

2

What is your connection String to the database?

Make sure it has the encoding specified on it:

jdbc:mysql://localhost:3306/DB?useUnicode=true&characterEncoding=UTF-8
cherouvim
  • 31,725
  • 15
  • 104
  • 153
  • Thanks, i knew there is such connection string property, but didn't guess the solution is so simple ! Anyway I think default character set of my server was not utf-8 & this coused the problem, I changed my connection string to this & problem sovled :
    jdbc:mysql://localhost:3306/db?useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8&connectionCollation=UTF8_PERSIAN_CI
    – Ehsan Khodarahmi Apr 25 '10 at 07:36