Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Special Characters in JSP

Status
Not open for further replies.

sgbender

Programmer
Dec 22, 2008
1
US
Hi,

I am kind of new to JSP. I am having trouble outputing something:

<%=request.getParameter("UserName")%>

now if UserName has special Characters (i.e &hearts; ) it does not get outputed corectly. that code above should display the heart symbol, but instead I get something like this: âÂ...

is there some kind of converstion function I can use?

Thanks.
 
I would say if you input a heart symbol by "copy and paste" in
Windows, you may have a chance to copy excess invisible character, so the result is not the heart.

If you let user to use mouse to click on a heart symbol to include a heart symbol in his name(your html page add &hearts; to the user name), it can prevent copying excess invisible character.

Let user input the text "&hearts;" indirectly or saving "&hearts;" into database is better than allowing user to type control code.
 
To conclude, if you really want to accept the heart symbol. It
is better to make user input html code like "&hearts;" instead of inputting a special character by copy and paste.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top