Link to home
Start Free TrialLog in
Avatar of ashokpappu
ashokpappu

asked on

special characters in URL

Hello,

I am using iplanet webserver 6.0 and am reading requests from request object in servlets
string str = request.getParameter("parameter");

when i pass a string which has special characters like ėĕ I am getting bad values in the string.  I need to attach the strings like that in email and send it or store it in a flat file.
what is causing the the junk value to come into request object.  I know that the characters ėĕ are coming in as junk because when i try to print the ascii values of the characters ny type casting the characters to int it is printing values of 65565.  java is supposed to be uni code right?
thanks
AShok Pappu
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

You may need to decode your parameter, try see if this work?

string str = java.net.URLDecoder.decode("" + request.getParameter("parameter"),"UTF8");
Avatar of CrashRoX
CrashRoX

The & symbol is causing it to think it is a new variable being passed. You will need to urlencode the values and then urldecode them on the other end. The encoding iwll change the characters so they may be passed in a friendly manner.
Avatar of ashokpappu

ASKER

I am sorry that the website(experts -exchange.com) has incorrectly interprited my example.

Let us say that in the word entrie (french) (i.e letter e with a style cap on top ') is typed on the browser page and submitted to the website. it is coming in as some character which is unreadable the ascii value is some thing around 65536.  I don't know how or why.  This is simple text there are no &# as the website (experts-exchange.com) interprets french characters.  

Let us say that some one has typed a email in french and clicked submit button on the web page.  When i do request.getParameter("emailBody")  and print the string return value with a log(request.getParameter("emailBody").  Where ever there are french characters there is junk. when i try to write this to a file it is being displayed as ???.  do i need to convert the string to any other format.  
please advise.

ASKER CERTIFIED SOLUTION
Avatar of JohnModig
JohnModig

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial