Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Encoding an URL  RSS feed

 
Pierre Peron
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have problem while trying to Encode an URL:
<a href="test.jsp?arg=<%= value %>">Link name</a>

The variable "value" that is transmited can contain some specific characters or foreign characters. So I tried to encode the URL:
<a href="test.jsp?arg=<%= URLEncoder.encode(value, "UTF-8") %>">Link name</a>

It works with specific characters (like %@& ...) but not with foreign characters.

What should I add?
[ June 21, 2006: Message edited by: Pierre Peron ]
 
Paul Clapham
Sheriff
Posts: 22509
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is very hard to say without knowing what the problem is. Could you provide some information about what "works" means?
 
Richard Green
Ranch Hand
Posts: 536
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did you try response.encodeRedirect("some url")
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!