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: 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");
Who is Participating?
CEHJConnect With a Mentor Commented:
Would have to be
String descURL = URLEncoder.encode(desc);

Open in new window

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

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.
Upgrade your Question Security!

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

>>also work in Java 1.5?

Yes, but it will be marked as deprecated
> 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

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.