This discussion is archived
2 Replies Latest reply: Mar 31, 2010 4:08 AM by 843810 RSS

Chinese locale date getting junk characters

843810 Newbie
Currently Being Moderated
I m calling servlet using below given line of code.
MyServlet is mapping of my servlet.
function getData(){
     document.location = '../../MyServlet?svalue='+svalue+'&'+ pbody;
}
this js function is written in jsp which has set
<%@ page contentType="text/html;charset=UTF-8"%>
and
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">

When the browser is in the chinese language, my "myDate: field have date set in chinese locale.

but when I m retrieving field set in request parameter using = request.getParameter("myDate");

I get junk characters in my servlet because of which date parsing fails.

Do u have idea why this mught be happening ?
  • 1. Re: Chinese locale date getting junk characters
    DrClap Expert
    Currently Being Moderated
    This article might help:

    [Character Conversion from Browser to Database|http://java.sun.com/developer/technicalArticles/Intl/HTTPCharset/]
  • 2. Re: Chinese locale date getting junk characters
    843810 Newbie
    Currently Being Moderated
    <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
    <Connector
    port="8080" maxHttpHeaderSize="8192"
    maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
    enableLookups="false" redirectPort="8443" acceptCount="100"
    connectionTimeout="20000" disableUploadTimeout="true"
    URIEncoding="UTF-8"
    useBodyEncodingForURI ="true"
    />
    I have added below given parameters:
    URIEncoding="UTF-8"
    useBodyEncodingForURI ="true"

    But I would like to know, if anyone know any bad effects of this ?We will be using UTF-8 encoding in our application.