File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Chinese name in URL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Chinese name in URL" Watch "Chinese name in URL" New topic

Chinese name in URL

aman bhatt

Joined: Nov 11, 2005
Posts: 5
From my first jsp I am selecting a Chinese pdf file and posting the first jsp to the second one.
In my second jsp when I am trying to fetch the File Name value from the field with request.getParameter("FileName") but I am getting a different junk value.
Though in my first jsp I have set, response.setCharatcerEncoding('UTF-8'). I am working on a windows environemnt and my app/Webserver server is Jboos-tomcat-apache.

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

I've never done chinese, but I don't think UTF-8 will work. Chinese requires 16-bit characters.

An IDE is no substitute for an Intelligent Developer.
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

UTF-8 can represent all Unicode characters. Including Chinese.

Aman, I don't understand what "posting the first jsp to the second one" means. And you don't say whether the data in the first JSP is correct, or even where it is coming from. An explanation of where this string comes from and how it is transformed on its travels would help.
syd kahn

Joined: Aug 23, 2005
Posts: 12
Are you using struts? if yuou are struts doesn't seem to get the utf characters correctly to the form bean - i had this problem...
yang donf

Joined: Nov 16, 2005
Posts: 3
before you post the form,you should encode the chinese characters into GB2312 or GBK
like this " string.getBytes("GBK",UTF-8); "
and in your second jsp file,you must encode it again,like this
in the end,you should notice the HTML tag
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
it is hard to display correctly,because your page charset=ISO-8859-1
It is sorta covered in the JavaRanch Style Guide.
subject: Chinese name in URL
It's not a secret anymore!