admin管理员组文章数量:1429728
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 binations like %^ before calling the actual decodeURI?
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 binations like %^ before calling the actual decodeURI?
Share Improve this question edited Dec 31, 2019 at 20:19 Jeff Mergler 1,54422 silver badges30 bronze badges asked Nov 26, 2009 at 7:25 balalakshmibalalakshmi 4,2366 gold badges42 silver badges48 bronze badges 3- 2 are you sure you dont mean to "encode" rather than decode? – Ayyash Commented Nov 26, 2009 at 7:31
- 1 Why is that %^ in the URI anyway, and what do you want it to be decoded to? – Carl Smotricz Commented Nov 26, 2009 at 7:32
- 1 Agreed, at least why is % there, because it is the escape character for encoding other URI entities. Plus you have other non ASCII characters in the URI, which should be encoded, as it isn't safe to assume Unicode characters can be handled in URIs – Kitson Commented Nov 26, 2009 at 8:18
1 Answer
Reset to default 4That 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";
本文标签: javascriptproblems with decodeURI withcharactersStack Overflow
版权声明:本文标题:javascript - problems with decodeURI with %^ characters - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745497675a2660881.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论