Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

webwork and Unicode

  Asked By: Oscar    Date: Aug 18    Category: Java    Views: 762
  

Trying to adopt a opensource package based on webworks I faced this problem: Textfields couldn't understand that thre entered text is farsi! and at the server side I recieve junk chars. I think I should change the resquest encoding to UTF-8 manually, But I don't know how?!
Any suggestion?

Share: 

 

5 Answers Found

 
Answer #1    Answered By: Jet Brown     Answered On: Aug 18

Most probably there's a velocity.properties file somewhere in the classpath
with an inappropriate value for the encoding attribute. Modify or add this
file to the classpath of the webapp and change the encoding value to UTF-8
in it.

 
Answer #2    Answered By: Ludkhannah Fischer     Answered On: Aug 18

In "webwork.properties", you should set the encoding
property of webwork to correctly deal with UTF-8:

webwork.i18n.encoding=UTF-8

 
Answer #3    Answered By: Sairish Kauser     Answered On: Aug 18

but still not working!
I tried Ara's suggestion and Armond's one. Also set
the output.encoding and input.encding inside the
velocity and webwork files; Nothing changed.
Testing the error is really simple depoy te
webwork-example.war and try the basicValidation
example, when the iput data is not OK it returns to
the input page, but Farsi characters turned to junk.
I faced something named " Velocity dispatcher" do I
need to configure this one also?!

 
Answer #4    Answered By: Javairea Akram     Answered On: Aug 18

It's a good practice (not only for this problem  but everywhere) to try removing all the unwanted parameters for solving a problem. Don't try many things together. By this, you will exactly go to the point. For example, first you make sure that your database is functioning properly. The following can be a way to verify this:

1. What is your database? Does it support UTF properly?
2. Did you check your database manually to check how to save a farsi text  in the?
3. What SQL queries are you using to enter or update the data in your java application? Try the same queries by your database sql editor (eg. Query Analyzer) and check the result.

Then, try to run a very minimized java program which saves a hard-coded farsi text to your database (not a text from user input). This will help you to find out many details about what you are trying to do. For example, if you aim to have some UTF Farsi text in a .properties file but save it in ANSI, it may return junk data. Or if you have a jsp file to display farsi data and it's not saved in UFT-8 format, even if you have correct data from the persistent layer, the data will not come correctly. These details are very important.

At the end, when all the details are true, try everything with your framework. Now, you have only one parameter left that is the Webwork (or wathever). You will not be confused any more about the place that causes your problem.

 
Answer #5    Answered By: Laura Rodriguez     Answered On: Aug 18

Who talked about a db?! My problem  is input strings?!

Any way I partially solved it wit a filter, but I
would like to hear a webwork native solution!

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




Tagged: