开发者

ampersand in URL of RSS Feed

As part of our app, user 开发者_如何学Pythoncan save some data as XML on server which becomes RSS feed for them.

Now some of the file user created have & in file name as BB&T_RSS.xml.

So when user point this to http://example.com/BB&T.xml, they won't get this.

How to stop this? I tried BB%26T.xml, BB&T.xml without any success with IE, Chrome


use an

%26

for an

&

http://example.com/BB%26T.xml,

http://www.w3schools.com/tags/ref_urlencode.asp

then use

HttpServerUtility.UrlDecode Method

to get the file from the url again

URL encoding ensures that all browsers will correctly transmit text in URL strings. Characters such as a question mark (?), ampersand (&), slash mark (/), and spaces might be truncated or corrupted by some browsers. As a result, these characters must be encoded in tags or in query strings where the strings can be re-sent by a browser in a request string.

Many URL schemes reserve certain characters for a special meaning: their appearance in the scheme-specific part of the URL has a designated semantics. If the character corresponding to an octet is reserved in a scheme, the octet must be encoded. The characters ";", "/", "?", ":", "@", "=" and "&" are the characters which may be reserved for special meaning within a scheme. No other characters may be reserved within a scheme. (src)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜