Reputation: 4208
Code:
<script type="text/javascript">
var uri = "%^my test**.asp?name=ståle&car=saab";
document.write(decodeURI(uri));
</script>
Error:
Line: 6
Error: The URI to be decoded is not a valid encoding
Is there anyway of decoding the combinations like %^ before calling the actual decodeURI?
Upvotes: 0
Views: 6464
Reputation: 100120
That is not a valid URI. URIs aren't allowed to contain unencoded non-ASCII or reserved characters. You can't use literal %
, it has to be encoded as %25
.
var uri="%25^my%20test.asp?name=st%C3%A5le&car=saab";
Upvotes: 4