charset sniffing

sniffing

[53] データのバイト列を検査してそのMIME型などを決定することを、sniffing といいます。

目次

  1. MIME sniffing (Web)
  2. 符号化 sniffing (Web)
  3. 特別な記述を検出する手法
  4. file(1)
  5. MIME magic
  6. JSON の BOM sniffing
  7. RDFa 処理器の Sniffing
  8. IPP の Sniffing
  9. バイト数
  10. 相互運用性
  11. セキュリティー
  12. 関連
  13. メモ

MIME sniffing (Web)#

[1] Web では、 MIME sniffing によって MIME型が決定されます。

MIME sniffing 参照。

符号化 sniffing (Web)#

[69] encoding sniffing (charset sniffing) は、 バイト列からその符号化を推定するアルゴリズムです。

[4] Webcharset sniffing アルゴリズム
[2] まとめと比較は復号器を参照。

特別な記述を検出する手法#

[3]

[13] 関連: コメントの中身が意味を持ってしまう

file(1)#

[5] file(1) 参照。

MIME magic#

[97] 多くのプラットフォームMIME magic などと称するツールがあります。 これは、ファイルの先頭のバイト列から MIME型を推定するものです。

MIME magic 参照。

JSON の BOM sniffing#

[25] RFC 4627JSONcharset sniffing について言及しています。

JSON 参照。

RDFa 処理器の Sniffing#

[50] RDFa 1.1 に基づく RDFa処理器は、 MIME型によってホスト言語を決定しなければなりませんMIME型を決定できないか未対応の時は、 application/xml としなければなりません>>49

[51] >>50 の直後にこれと矛盾する次のような「NOTE」があります。 MIME型が無い時、 DOCTYPE根要素拡張子利用者定義の引数など追加の仕組みを用いても構いません >>49

IPP の Sniffing#

[82] RFC 2911 - Internet Printing Protocol/1.1: Model and Semantics ( 版) https://tools.ietf.org/html/rfc2911#section-4.1.9.1

One special type is 'application/octet-stream'. If the Printer object supports this value, the Printer object MUST be capable of auto-sensing the format of the document data using an implementation-dependent method that examines some number of octets of the document data, either as part of the create operation and/or at document processing time.

バイト数#

[10] HTMLencoding sniffing algorithm は先頭1024バイトを1つの基準としています。

[12] CSS encoding sniffing は先頭1024バイトを検査します。

[11] MIME sniffing は先頭1445バイトを検査します。

相互運用性#

[14] sniffing発見的方法によることが多く、相互運用性に乏しいのが問題です。

[15] Webプラットフォームsniffing の方法も標準化していますが、 各実装は完全にそれに従っているわけではなく、 相互運用性の問題は皆無ではありません。

セキュリティー#

[16] sniffing相互運用性の問題は、そのままセキュリティーの問題となります。

[17] とりわけ、安全と考えられているファイル形式が危険なファイル形式と(誤)判定され得る状況は、 しばしば悪用されます。

[18] 故に、

セキュリティーのために極めて重要と考えられています。

関連#

[6] ファイル形式も参照。

[7] browser sniffing も参照。

メモ#

[8] Editorial: further cleanup "abort these steps" (shreyateeza著, ) https://github.com/whatwg/html/commit/99e2cdfc484c2ff14cbf5c38b859f4d6da17e64c

[9] rouge/lib/rouge/guessers at master · jneen/rouge () https://github.com/jneen/rouge/tree/master/lib/rouge/guessers

[23] TOPICS - VC, , https://web.archive.org/web/19980131160510fw_/http://www.villagecenter.co.jp/cgi-bin/contents.cgi?0=TOPICS

<body bgcolor="black" text="white" link="yellow" vlink="#FF8080">
<!--
あいうえおかきくけこさしすせそたちつてと
IEが EUC を認識しないので、その対策です。(^_^;
-->

[24] Word で「打」で始まるテキスト ファイルを開くとコンバーターを要求される | Japan Office Client Support Blog, , https://officesupportjp.github.io/blog/cm15ufuis0000f0seec0i7yev/