• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 213
  • Last Modified:

translate into http character codes - 1.3

My string could potentially look something like this:

  abc def/ghi__$jkl/0324aff

I need to pass this string to a web page (PHP), via GET.

But obviously, I can't just do:

  http://domain/page.php?str=abc def/ghi__$jkl/0324aff

Because the parameter can only contain a-z, A-Z, and 0-9.

So, in Java 1.3 here, I need to turn that string into something which is valid ....


Any ideas?

Thanks
0
InteractiveMind
Asked:
InteractiveMind
  • 3
1 Solution
 
CEHJCommented:
String escapedParam = java.net.URLEncoder.encode(yourParam);
0
 
InteractiveMindAuthor Commented:
that was easy :)

Thanks
0
 
CEHJCommented:
Non-deprecated:

String escapedParam = java.net.URLEncoder.encode(yourParam, "UTF-8");
0
 
CEHJCommented:
:-)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now