开发者

Reading special characters from URL query string

开发者 https://www.devze.com 2023-03-22 00:33 出处:网络
I have a situation where the user is able to enter any characters they want in a URL query string. Example:

I have a situation where the user is able to enter any characters they want in a URL query string.

Example:

http://localhost/default.aspx?ID=a‡jljglkjg

How can I accept special characters such as ‡, ˆ, and † in asp.net from a URL query string? I am finding that when开发者_StackOverflow I attempt to retrieve these URL query string these special characters gets replaced with a “?”.

Note: The user inputs these query string into the URL.


This URL is wrong according to RFC.

  • If they are using browser, it would normally do the ecndoing required.
  • If it is done by JavaScript, use encodeURIcomponent
  • If it is a C# app, using HttpUtility.UrlEncode here


URLs can only be sent over the Internet using the ASCII character-set.

Those characters will always be excluded, you need to find another way to do it.


See http://www.w3schools.com/tags/ref_urlencode.asp for more information about valid URLs and encoding special characters.

0

精彩评论

暂无评论...
验证码 换一张
取 消