Domanda

I have a link with half part in English and other half in Russian character.

ex: http://www.xxx.xx/?card=1234&/русский/как-это-сделать/

When I do a encodeURIComponent(document.URL) inside java script I get something like this http://www.xxxx.xx/card=1234&/%D0%BE%D0%BB%D0%B8%D0%BC%D0%BF%D0%B8%D0%B0%D0%B4%D0%B0/%D0%BE%D0%B2%D0%B5%D1%87%D0%BA%D0%B8%D0%BD-%D0%BD%D0%B5-%D0%BF%D0%B

How to do a url encode inside java script so that I get a meaningful url to send (Which is exactly like the document URL, with the Russian character).

Thanks ; :)

È stato utile?

Soluzione

The following Javascript code solves your problem:

encodeURI("http://www.xxx.xx/?card=1234&/русский/как-это-сделать/")
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top