سؤال

شفرة:

<script type="text/javascript">  
  var uri**="%^my test**.asp?name=ståle&car=saab";
  document.write(decodeURI(uri));   
</script>

خطأ:

Line: 6
Error: The URI to be decoded is not a valid encoding

هل هناك على أي حال فك تشفير المجموعات مثل ٪^ قبل استدعاء 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";
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top