在HTTP标头内是unicode用户代理合法吗?

编程入门 行业动态 更新时间:2024-10-26 14:27:17
本文介绍了在HTTP标头内是unicode用户代理合法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在维护的应用程序使用'latin1'字符集将从Web日志中提取的用户代理加载到MySQL表列中。有时,它无法加载如下所示的用户代理:

An application I'm maintaining loads user agents extracted from web logs into a MySQL table column using the 'latin1' charset. Occasionally, it fails to load a user agent that looks like this:

Mozilla / 5.0(I??CPU iPhone OS 5_0_1,如Mac OS X )AppleWebKit / 534.46(像Gecko一样的KHTML ^ C)版本

我怀疑它在上窒息了?。我正在努力弄清楚是否应该支持它,或者它是否是上游日志记录系统引入的损坏。这是HTTP标头中的合法用户代理吗?

I suspect it's choking on Iâ?. I'm working to figure out if this should be supported, or if it's corruption introduced by the upstream logging system. Is this a legal user agent in a HTTP header?

推荐答案

RFC 2616(HTTP 1.1)说邮件标题内容必须由 * TEXT 组成或者令牌,分隔符和带引号的字符串的组合。如果您查看TEXT等的定义,会发现合法字符是字节值不在[0,31]范围内且不等于127的字符;因此,根据规范,â等字符是我所能说的合法。

RFC 2616 (HTTP 1.1) says that message header contents must be "consisting of either *TEXT or combinations of token, separators, and quoted-string". If you look at the definitions for TEXT etc you will find that legal characters are those with byte values not in the [0, 31] range and not equal to 127; therefore characters such as â are as far as I can tell legal as per the spec.

更多推荐

在HTTP标头内是unicode用户代理合法吗?

本文发布于:2023-11-10 10:35:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1575121.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:用户   HTTP   标头内是   unicode

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!