?
Solved

special characters in URL

Posted on 2005-02-24
7
Medium Priority
?
1,661 Views
Last Modified: 2013-12-03
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
0
Comment
Question by:ashokpappu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 13399459
You may need to decode your parameter, try see if this work?

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

Expert Comment

by:CrashRoX
ID: 13400832
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.
0
 

Author Comment

by:ashokpappu
ID: 13415835
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.

0
 
LVL 11

Accepted Solution

by:
JohnModig earned 252 total points
ID: 13418653
In your form, change action="get" to action="post" and then do request.form("field") instead.
Then you do not have to deal with how your browser interpet the special characters.
0
 

Assisted Solution

by:CrashRoX
CrashRoX earned 248 total points
ID: 13427482
JohnModig is right, you should request email content as a get. For one it will limit the available size of the passed data. Its a bit more insecure. Thirdly its causing those character letters.
0

Featured Post

How To Install Bash on Windows 10

Windows’ budding partnership with Canonical has certainly led to some great improvements. One of them being the ability to use Bash on your Windows machine without third party applications! This might be one of the greatest things a cloud engineer in a Windows environment can do!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will learn how to count occurrences of each item in an array.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question