Skip to content Skip to sidebar Skip to footer

Fastest Way To Encode Cyrillic Letters For Url

If you copy the link below into the browser http://be.wikipedia.org/wiki/Беларусь it will show the Wiki article. But once you want to copy that link (or any other link t

Solution 1:

The function you're searching for is encodeURIComponent.

encodeURIComponent("Беларусь");
// returns "%D0%91%D0%B5%D0%BB%D0%B0%D1%80%D1%83%D1%81%D1%8C"

Its counterpart is decodeURIComponent which reverses this process.

decodeURIComponent("%D0%91%D0%B5%D0%BB%D0%B0%D1%80%D1%83%D1%81%D1%8C");
// returns "Беларусь"

Solution 2:

I guess encodeURI(string) should be what you are looking for. Just check out already existing answers to the same question e.g. here!


Post a Comment for "Fastest Way To Encode Cyrillic Letters For Url"