Encoding detection unpredictable

オープン
#105 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
java

調査の方向性

まず java -cp vnu.jar nu.validator.servlet.Main 8888 でバリデーションサーバーを起動し、リンクされた testCase.txt と ApacheBench コマンドを使ってレポートを再現します。断続的に発生する “big5” の検出と “Unmappable byte sequence” メッセージについて、同時実行時のレスポンスを比較します。繰り返し同時実行したバリデーションで、散発的な結果が発生せず、予測可能な charset 検出が行われれば完了です。

索引モデルが issue の本文から書いたものです。

説明

When validating multiple files in concurrency, the encoding detection is not always predictable.
The easiest way to explain is probably to reproduce my test case:

  • launch the validation server (15.6.29)
java -cp vnu.jar nu.validator.servlet.Main 8888
ab -T"text/html; encoding=utf-8" -p testCase.txt -c 100 -n 10000 -v 4 http://localhost:8888/?out=json | grep Unmappable

You should obtain some results of the form (if not, try to restart the server and re-validate):

{"messages":[{"type":"info","message":"The Content-Type was “text/html”. Using the HTML parser."},{"type":"error","message":"The character encoding was not declared. Proceeding using “big5”."},{"type":"error","lastLine":7,"lastColumn":47,"message":"Unmappable byte sequence: “c2”, “a0”."},{"type":"info","message":"Using the schema for HTML5 + SVG 1.1 + MathML 3.0 + RDFa Lite 1.1."}]}

As you can see, the detected encoding is sometimes "big5", but only once or twice among thousands... hence the unpredictability.
When this encoding is detected, the unbreakable space triggers the "Unmappable byte sequence" error.

I think the charset detection should be predictable.
My test demonstrate it is not.

Regards

主要言語
Java
スター
65
フォーク
29
平均マージ
11日 21時間
マージ済み PR(30日)
3

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

validator/htmlparser のほかの issue

validator/htmlparser の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。