HttpServletRequest.getCharacterEncoding -- useless?
Does the subject API ever return anything useful. Using Tomcat 5, I can't get it to return anything but null. Googling around, it seems that other servlet containers either always return null or always return some default value (usually ISO-8859-1). How the heck am I supposed to process form input if I can't figure out how it's encoded? Thanks! -- Ian Pilcher[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: HttpServletRequest.getCharacterEncoding -- useless?
Hi, The JavaDocs for java.net.URLDecoder suggest that you're fairly safe with URLDecoder.decode(String s, UTF-8). Yoav Shapira Millennium Research Informatics -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Ian Pilcher Sent: Thursday, July 29, 2004 3:24 PM To: [EMAIL PROTECTED] Subject: HttpServletRequest.getCharacterEncoding -- useless? Does the subject API ever return anything useful. Using Tomcat 5, I can't get it to return anything but null. Googling around, it seems that other servlet containers either always return null or always return some default value (usually ISO-8859-1). How the heck am I supposed to process form input if I can't figure out how it's encoded? Thanks! -- === = Ian Pilcher [EMAIL PROTECTED] === = - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HttpServletRequest.getCharacterEncoding -- useless?
Ian Pilcher wrote: Does the subject API ever return anything useful. Using Tomcat 5, I can't get it to return anything but null. Googling around, it seems that other servlet containers either always return null or always return some default value (usually ISO-8859-1). OK, getCharacterEncoding isn't completely useless. It is, however, almost completely useless. AFAICT, it only works if the client includes the encoding in the Content-Type HTTP header. If I manually create an HTTP request with: Content-Type: application/x-www-form-urlencoded;charset=UTF-8 request.getCharacterEncoding returns UTF-8. Unfortunately, neither IE nor Mozilla do this. There is a Mozilla bug open: http://bugzilla.mozilla.org/show_bug.cgi?id=241540 I encourage anyone who is getting bitten by this issue to vote for this bug. -- Ian Pilcher[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]