This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Servlets and the fly likes problem with request.getParameter() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "problem with request.getParameter()" Watch "problem with request.getParameter()" New topic

problem with request.getParameter()

Raj Kumar Bindal
Ranch Hand

Joined: Apr 15, 2006
Posts: 418
**I am passing value to a servlet through URL through BufferedWriter.write().
sending code for calling servlet:
URL url = new URL("");
URLConnection conn = url.openConnection();
BufferedWriter out =new BufferedWriter(new OutputStreamWriter( conn.getOutputStream() ) );

**And receiving values in dopost,but some of my characters are getting changed and are getting replaced by ?.
**Plz tell me if this is problem of servlets or request.getParameter().
**Also, in which form request.getParameter() read the parameter as Bytes or as characters.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8927

Set the proper character encoding before reading.
For e.g. request.setCharacterEncoding("UTF-8");

What is the encoding type?

Kristof Camelbeke
Ranch Hand

Joined: Nov 28, 2001
Posts: 97
If I understand correctly I think you'll have to use a url encoder like to encode the url with the parameters so for example the spaces in your parameters are transformed to +...

Hope this helps
Raj Kumar Bindal
Ranch Hand

Joined: Apr 15, 2006
Posts: 418
I am sending characters of DVBW-TTYogeshEn font.
Which encoding will work for this.
I agree. Here's the link:
subject: problem with request.getParameter()
It's not a secret anymore!