Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 25-10-2008
Member
 
Join Date: Oct 2008
Posts: 31
encodeURIComponent equivalent in Java

Is there an equivalent for encodeURIComponent in Java?
Reply With Quote
  #2  
Old 25-10-2008
Member
 
Join Date: Feb 2008
Posts: 1,848
Re: encodeURIComponent equivalent in Java

Do you think you could explain in detail what it does or give a link to some documentation of this function? It would make it much easier for people to answer your question.
Reply With Quote
  #3  
Old 25-10-2008
Member
 
Join Date: Oct 2008
Posts: 31
Re: encodeURIComponent equivalent in Java

encodeURIComponent is a JavaScript URI Encoding function.

See:
http://msdn.microsoft.com/library/de...icomponent.asp
Reply With Quote
  #4  
Old 25-10-2008
Member
 
Join Date: May 2008
Posts: 2,293
Re: encodeURIComponent equivalent in Java

I'm not sure about the subtle differences between URI and URL. But I think URLEncoder.encode(String) is roughly what you want.

<http://java.sun.com/j2se/1.4.2/docs/api/java/net/URLEncoder.html#encode(java.lang.String)>
Reply With Quote
  #5  
Old 25-10-2008
Member
 
Join Date: Apr 2008
Posts: 2,001
Re: encodeURIComponent equivalent in Java

Since I'm UTF-8, I will add that URLEncoder.encode(x, "UTF-8") will ensure all non-ASCII characters are also escaped in byte pairs (see http://www.w3.org/TR/html40/appendix...on-ascii-chars.

After many hours of pondering this character set problem () I discovered that the standard is and doesn't allow character sets other than US-ASCII in the URL. So the above way is the defacto standard.

That is all, time for the
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags:



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "encodeURIComponent equivalent in Java"
Thread Thread Starter Forum Replies Last Post
Equivalent to Java finally keyword in PHP Jaganmohini Software Development 6 12-08-2010 10:20 AM
ATI equivalent to GTX 260 SLI Tanveer Joshi Monitor & Video Cards 6 18-05-2010 12:00 AM
Need some equivalent applications for MAC Abhibhava Windows Software 5 27-12-2009 01:04 AM
Equivalent of #define in C# Luis234 Software Development 6 20-04-2009 11:56 PM
Equivalent of the TAT Xeusion Overclocking & Computer Modification 3 26-11-2008 07:19 PM


All times are GMT +5.5. The time now is 09:01 PM.