You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tika.apache.org by "question.answer.id@gmail.com" <qu...@gmail.com> on 2016/09/14 11:27:43 UTC
Apache Tikaで、EUCやshift-jisコードのhtmlの読込みで文字化け
こんにちは。
困っております。
Apache Tikaで、EUCやshift-jisコードのhtmlの読込みで文字化けします。
原因は何で、対応策(Tikaへの設定?など)は、ありますでしょうか?
■読み込むと文字化けするhtmlを添付します。
※EUCコードのファイルです。(秀丸エディタの判定では)
ソース:
-----------------------------------------------------
File document = new File("/usr/local/sample.pdf");
Parser parser = new AutoDetectParser();
ContentHandler handler = new BodyContentHandler(Integer.MAX_VALUE);
Metadata metadata = new Metadata();
parser.parse(new FileInputStream(document), handler, metadata
, new ParseContext());
String plainText = handler.toString();
System.out.println(plainText);
-----------------------------------------------------
--
技術初心者