2017-06-21 15:26 GMT+02:00 Florian Apolloner <[email protected]>: > Sorry I've mixed it up with with encodeURI. encodeURIComponent takes the > "safe" route and escapes everything (at least as far as I understand it) > because it does not know where the component (unless "component" itself has > a sepcific meaning that I am not aware of) ends up -- this also makes the > function somewhat ugly to use because you escape more than you need to. On > the other hand, if you use encodeURI: > > encodeURI('http://google.com?:a=:asd') > "http://google.com?:a=:asd" > > it does not escape ':' since it knows that there is no need to escape it.
This is a side note, but actually encodeURI can't be used to encode query string parameters. It won't quote = or & either, as you can see from your example. You need to use encodeURIComponent on each of the parts separately. So of the pair, encodeURI is probably the one that has questionable use as you said, I've personally never needed it. Ole -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CANb2OvK9AfqBJCa35qOnkELtdTpp7SuMtqqsqJ5kYdHNha4d6g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
