• 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

Tomcat Unicode [was: jQuery.ajaxForm Chinese Characters]

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm having a time with posting chinese characters to the server. I have the following:



The ajaxForm is posting chinese content but when I look at the header content it is changed. I post in the text field 请选择基色 but what gets put in the header is ����€‰�‹��Ÿ��‰�.

And the some other gibberish comes back out. As far as I know everything is set to use UTF-8. The JSP, JavaScript, from what I understand, is UTF-8 by default, the response. Other code on the server that is chinese (entered directly into the database) displays fine which is why I think it has something to do with what is happening in the browser before it even gets to the server.

Any tips?
[ March 07, 2008: Message edited by: Gregg Bolinger ]
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A bit of an update. I noticed that the content-type in the header being sent to the server is "text/plain". I was able to tell apache to ALWAYS use UTF-8 regardless of what the page states so now I get "text/plain; utf-8" which is, maybe, half way there.

What I am expecting is "text/html; utf-8" and I am not understanding why the POST isn't being sent like this even though the page is sent as such.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I moved this to the Tomcat forum because the exact same code works fine in weblogic which leads me to believe this has to be a Tomcat issue since that is the only difference between the two environments.

Weblogic seems to set the header correctly and all is well. Tomcat does not. I've been googling but not coming up with much so any help would be appreciated.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried explicitly setting the character encoding to "text/html; charset=UTF-8"

in your JSP or servlet?
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletResponse.html#setCharacterEncoding(java.lang.String)
http://java.sun.com/j2ee/1.4/docs/api/index.html
[ March 07, 2008: Message edited by: Ben Souther ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic