Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

utf-8 on actionform

 
Roberto Lopez Lopez
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

I need to use utf-8 on my form. The JSP shows non-ascii characters well, but when I get back into my action I can't get the values from my attributes on utf-8. I'm sure the problem is only on the form, because I can get utf-8 strings from my resources file and display it properly. For example:

14:33:57,312 INFO [STDOUT] 43 - Siguiente subcategor��a - Siguiente subcategor�a


Where I get the text before the '-' from my form, and the text after from my resources file.

I'm declaring utf8 on my JSP as following:



Can anybody help? Thanks in advance...
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't believe that UTF-8 is the right value to use as character set for European languages. Try ISO-8859-1 instead.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that "multipart/form-data: charset=utf-8" is not a valid enctype; the encoding can't be specified in this way. Generally, the browser will use whatever encoding the page was delivered in. So if the contentType is UTF-8, then it should use UTF-8 for the form submission.

To make this explicit you can use the "accept-charset" form attribute. At least, that's what the HTML standard says how it should happen.
[ June 24, 2008: Message edited by: Ulf Dittmer ]
 
Roberto Lopez Lopez
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Merrill: ask my boss, it's one of the requirements...

The JSP has now these lines:



But the data from the form keeps "Siguiente subcategor��a" instead of "Siguiente subcategor�a". I've tried with other html:form attributes, but simply can't avoid this error. Any idea there? Is there another way to define the encoding?
 
Roberto Lopez Lopez
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SOLVED:

JBoss sends everything in ISO-8859-1, even if I say UTF-8 on the jsp. I wrote a method to traduce every message into UTF-8.





Now I'm writing a filter to automatically traduce everything without need to call this method.

Thanks for your support!!!

Reference:http://www.jboss.com/index.html?module=bb&op=viewtopic&t=84678#3952987
 
Patrick Houston
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem can be solved by adding the following code to the actionform reset and validate methods:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic