• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

struts with character encoding problem

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a struts <html:text> field and I would like to allow user to input Chinese Characters. I am using UTF-8.
When pressing the submit button, it will write to the Oracle DB and get it back at once and display back to the struts textfield. However what I get back is some strange symbols. Even though I have set
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> and
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %> in jsp page and request.setCharacterEncoding("UTF-8"); in struts action. It still didn't work. (As I heard that request.setCharcterEncoding() will set all request data to the specific charset, but I am now using form beans to get and set data rather than request.getParamter() ). So anyone can give me some suggestions?
I know that it works when I use new String(value.getByte("ISO-8859_1"), "UTF-8") , but I can't use it in every string as there will be 60 fields in that page. It will be very troublesome to set every field to UTF-8. Is there any method that I can set all the data to UTF-8 in the simplest way? Thx a lot.
(SunOne appserver 7.0)
(JSP, struts, EJB)
(Oracle - with NLS setting to UTF-8)
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"poorjavapoorjava"-
Welcome to the JavaRanch! Please adjust your displayed name to meet the
JavaRanch Naming Policy.
You can change it
here.
Thanks! and welcome to the JavaRanch!
Mark
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"poorjava poorjava",
Thanks for changing your display name, but it is still not valid. As you can probably guess we take this rule quite seriously.
Your display name must be two words: your first name, a space, then your last name. Fictitious names are not allowed. Please change it to your real name or a close copy since accounts with invalid display names get deleted.
thanks,
Dave.
 
My previous laptop never exploded like that. Read this tiny ad while I sweep up the shards.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic