how do i use URLEncoder in Java 1.3 for a Solaris server?

I have the following in my jsp:
String descURL = URLEncoder.encode(desc, "UTF-8");

It works for Java 1.5 in a Linux server.  I need to make it also work in a Solaris server using Java 1.3.

What is the equivalent?

Error message:
java.net.URLEncoder cannot be applied to (java.lang.String,java.lang.String)
probably occurred due to an error in /jsp/sites.jsp line 100:
String descURL = URLEncoder.encode(desc, "UTF-8");
galaxy573Asked:
Who is Participating?
 
CEHJConnect With a Mentor Commented:
Would have to be
String descURL = URLEncoder.encode(desc);

Open in new window

0
 
objectsConnect With a Mentor Commented:
there was no charset then, so remove last parama

String descURL = URLEncoder.encode(desc);

The javadoc is always a good place to check as it will tell you when methods werew added

0
 
galaxy573Author Commented:
will String descURL = URLEncoder.encode(desc); also work in Java 1.5?  

I need to take my code and make it compatible in Java 1.3 & 1.5 & it'd be easier for me if i can find a solution that will work in both versions.
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
CEHJCommented:
>>also work in Java 1.5?

Yes, but it will be marked as deprecated
0
 
objectsCommented:
> will String descURL = URLEncoder.encode(desc); also work in Java 1.5?  

if you want it to be compatible with both then you must use that method

0
 
CEHJCommented:
:-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.