Results 1 to 5 of 5

Thread: encodeURIComponent equivalent in Java

  1. #1
    Join Date
    Oct 2008
    Posts
    31

    encodeURIComponent equivalent in Java

    Is there an equivalent for encodeURIComponent in Java?

  2. #2
    Join Date
    Feb 2008
    Posts
    1,852

    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.

  3. #3
    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

  4. #4
    Join Date
    May 2008
    Posts
    2,297

    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)>

  5. #5
    Join Date
    Apr 2008
    Posts
    2,005

    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

Similar Threads

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

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,958,028.14479 seconds with 17 queries