problems with decodeURI with %^ characters
Code:
<script type="text/javascript">
var uri = "%^my test**.asp?name=ståle&car=saab";
document.write(decodeURI(uri));
</script>
Er开发者_如何学编程ror:
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?
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";
精彩评论