3

如果查询字符串包含非英文字符,为什么 $_SERVER['HTTP_REFERER'] (PHP) 和 Request.ServerVariables("HTTP_REFERER") (ASP) 返回不同的结果?

php 返回正确的值,但 asp 不会:

php: сабака

asp: ׁ׀°׀±׀°׀÷׀°

4

1 回答 1

1

根据RFC 2616,不在 ISO-8859-1 中的字符应进行特殊编码。因此,似乎向您发送标头的人违反了规范。请参阅field-contentTEXT

4.2 消息头

message-header = field-name ":" [ field-value ]
field-name     = token
field-value    = *( field-content | LWS )
field-content  = <the OCTETs making up the field-value
                 and consisting of either *TEXT or combinations
                 of token, separators, and quoted-string>

2.2 基本规则

TEXT           = <any OCTET except CTLs,
                 but including LWS>

TEXT 规则仅用于不打算由消息解析器解释的描述性字段内容和值。仅当根据 RFC 2047 [ 14 ]的规则进行编码时,*TEXT 的字可能包含来自 ISO-8859-1 [22] 以外的字符集的字符。

于 2010-05-31T15:25:59.193 回答