What are people using as the length of a MIMEType field in their databases? The longest one we've seen so far is 72 bytes:
人们在数据库中使用什么作为MIMEType字段的长度?到目前为止我们看到的最长的是72字节:
application/vnd.openxmlformats-officedocument.wordprocessingml.document
but I'm just waiting for a longer one. We're using 250 now, but has anyone seen a longer MIMEType than that?
但我只是在等一个更长的时间。我们现在用的是250,但是有谁见过比这个长一点的MIMEType吗?
Edit: From the accepted answer, 127 for type and sub-type each, so that's 254 max, plus the '/' is a limit of 255 for the combined value.
编辑:根据已接受的答案,类型和子类型各为127,即254 max,加上'/'对组合值的限制为255。
1 个解决方案
#1
123
According to RFC 4288 "Media Type Specifications and Registration Procedures", type (eg. "application") and subtype (eg "vnd...") both can be max 127 characters. You do the math :)
根据RFC 4288“媒体类型规范和注册程序”,类型(如。“应用”)和子类型(如“vnd…”)都可以是最多127个字符。你算一下
Edit: Meanwhile, that document has been obsoleted by RFC 6838, which does not alter the maximum size but adds a remark:
编辑:同时,该文件已经被RFC 6838淘汰,它没有改变最大尺寸,但是添加了一个备注:
Also note that while this syntax allows names of up to 127 characters, implementation limits may make such long names problematic. For this reason,
<type-name>
and<subtype-name>
SHOULD be limited to 64 characters.还要注意,虽然这个语法允许最多127个字符的名称,但是实现限制可能会使这样长的名字出现问题。由于这个原因,
和 应该限制为64个字符。
#1
123
According to RFC 4288 "Media Type Specifications and Registration Procedures", type (eg. "application") and subtype (eg "vnd...") both can be max 127 characters. You do the math :)
根据RFC 4288“媒体类型规范和注册程序”,类型(如。“应用”)和子类型(如“vnd…”)都可以是最多127个字符。你算一下
Edit: Meanwhile, that document has been obsoleted by RFC 6838, which does not alter the maximum size but adds a remark:
编辑:同时,该文件已经被RFC 6838淘汰,它没有改变最大尺寸,但是添加了一个备注:
Also note that while this syntax allows names of up to 127 characters, implementation limits may make such long names problematic. For this reason,
<type-name>
and<subtype-name>
SHOULD be limited to 64 characters.还要注意,虽然这个语法允许最多127个字符的名称,但是实现限制可能会使这样长的名字出现问题。由于这个原因,
和 应该限制为64个字符。