I have got problem while inserting some data in polish language(characters like ąćęłóżź) into table. I’m getting some strange chars in table’s. In jsp files I have set page coding to utf 8.
Mysql worbench character-set-server set to utf8 and database collation to utf8_polish_ci.
I have also set windows enviroment variable JAVA_TOOL_OPTIONS to -Dfile.encoding=UTF8
I have got problem while inserting some data in polish language(characters like ąćęłóżź) into
Share
You’re not exactly descriptive as to which "strange chars" you’re seeing, but I’ll assume that you actually mean Mojibake such as
ÄÄÄÅóżźinstead ofąćęłóżźand thus not question marks such as???????instead ofąćęłóżź.You need to invoke
request.setCharacterEncoding("UTF-8")before you collect POST request parameters byrequest.getParameter(name), otherwise the server platform default one will be used to decode them from the query string, which is often ISO-8859-1 and not UTF-8.The best place to set the request character encoding is a servlet filter which is mapped on an URL pattern covering all POST requests.
See also