How to properly encode a url in javascript?

I am working on a browser plugin that takes the URL of the current page or any selected link as a parameter and sends it to our server. When the main Latin alphabet characters are present in the URL (for example, http://en.wikipedia.org/wiki/Vehicle ), the plugin works fine. However, when the URL contains characters from another alphabet, such as http://ru.wikipedia.org/wiki/Stroller , the plugin does not work, I use the method encodeURIComponent, but this does not seem to solve the problem. Any idea?

Thank,

Olivie.

+3
source share
2 answers

, encodeURI/decodeURI, URI , ASCII, . URI, : /, , ; -ASCII , URI. , , , , URI <a href="..."> ( ).

encodeURIComponent URI, , URI, URI.

+1

Source: https://habr.com/ru/post/1764753/


All Articles