• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

request.setCharactereEncoding doesn't work on Tomcat ?  RSS feed

 
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

[Please note: this is a continuation of a question I posted in the servlet sub-forum. However, the problem is now pin-pointed to the Tomcat implementation: either I'm doing something wrong, or it doesn't comply with the servelt spec...].

I'm having a problem with Tomca'ts implementation of


Here's the details:
  • I have an html < form > where user should type data in *Chinese*.
  • The browser (IE6) sends the data in UTF-8 ( server, encoded as UTF-8 ( this encoding is mentioned in my "content-type" as well as in < from accept-charset="UTF-8" > ).
  • I actually see that the browser sends the data *correctly* (this is a GET, so I can see the encoding)...
  • On the servlet size, I write:

  • request.setCharacterEncoding("UTF-8");
    String p=request.getParameter("name");
    // But this doesn't work...


    It seems like request.setCharacterEncoding() simply doesn't work : Tomcat reads the parameters as if they were "latin1" ... I can extract them by forcefully converting back to utf-8, but it's ugly and not portable...

    I know you can configure tomcat's < Connector > to use utf-8, but I really don't want to do it ( client has a standard Tomcat installation, and I'm not allowed to touch it).

    Am I doing something wrong, or is Tomcat just ignoring the j2ee spec in this point ?

    Thanks
     
    Everybody's invited. Except this tiny ad:
    how do I do my own kindle-like thing - without amazon
    https://coderanch.com/t/711421/engineering/kindle-amazon
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!