encode something js code example Example: how to encode a string in javascript var uri = "my test.asp?name=ståle&car=saab"; var res = encodeURI(uri);