Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
79
rated 0 times [  86] [ 7]  / answers: 1 / hits: 151633  / 15 Years ago, tue, april 14, 2009, 12:00:00

What is the difference between the JavaScript functions decodeURIComponent and decodeURI?


More From » javascript

 Answers
203

To explain the difference between these two let me explain the difference between encodeURI and encodeURIComponent.



The main difference is that:




  • The encodeURI function is intended for use on the full URI.

  • The encodeURIComponent function is intended to be used on .. well .. URI components that is
    any part that lies between separators (; / ? : @ & = + $ , #).



So, in encodeURIComponent these separators are encoded also because they are regarded as text and not special characters.



Now back to the difference between the decode functions, each function decodes strings generated by its corresponding encode counterpart taking care of the semantics of the special characters and their handling.


[#99708] Tuesday, April 7, 2009, 16 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jeffery

Total Points: 180
Total Questions: 114
Total Answers: 117

Location: Chad
Member since Mon, Dec 5, 2022
2 Years ago
;