忍者ブログ

素人翻訳

適当に翻訳する。

日本語のPDF文書を pdftohtml で変換する際、-enc に UTF-8 を指定

漢字等を含んだPDF文書に対して pdftohtml を実行すると、出来上がった html 文書に「â€」「Ã」などの文字が現れる。

このサイトを参考にして解決。

man pdftohtml によると、

...
-enc <string>
     output text encoding name
...

とういことなので、-enc に utf8、utf-8 などを渡してみると、

[悪い例@localhost ~]$ pdftohtml -s -enc utf8 aaa.pdf
Error: Couldn't find unicodeMap file for the 'utf8' encoding
[悪い例@localhost ~]$ pdftohtml -s -enc utf-8 aaa.pdf
Error: Couldn't find unicodeMap file for the 'utf-8' encoding

と出てしまう。

man pdftohtml 曰く、

...
AUTHOR
Pdftohtml was developed by Gueorgui Ovtcharov and Rainer Dorsch. It is based and benefits a lot from Derek Noonburg's xpdf package.
(訳)
(pdftohtml の開発者は、Gueorgui Ovtcharov と Rainer Dorsch の二人である。Derek Noonburg の xpdf パッケージを基にしており、同パッケージに負うところが大きい。)
...

man xpdf 曰く、

...
-enc encoding-name
Sets the encoding to use for text output. The encoding-name must be defined with the unicodeMap command (see xpdfrc(5)). This defaults to "Latin1" (which is a built-in encoding). [config file: textEncoding]
(訳)
(文の出力に用いる符号化方式を指定する。符号化方式の名前は、unicodeMap コマンド(xpdfrc(5) を見よ)で定義したものでなければならない。初期状態では「Latin1」に設定されている(これはビルトインの符号化方式である)。[config file: textEncoding])
...

man xpdfrc 曰く、

...
unicodeMap encoding-name map-file
...
The Latin1, ASCII7, Symbol, ZapfDingbats, UTF-8, and UCS-2 encodings are predefined.
(訳)
(符号化方式は Latin1、ASCII7、Symbol、ZapfDingbats、UTF-8、及び UCS-2 が予め定義されている。)
...

UTF8 を指定する場合は「UTF-8」を渡す。

[良い例@localhost ~]$ pdftohtml -s -enc UTF-8 aaa.pdf
PR

コメント

お名前
タイトル
文字色
メールアドレス
URL
コメント
パスワード Vodafone絵文字 i-mode絵文字 Ezweb絵文字

カレンダー

02 2024/03 04
S M T W T F S
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
18 19 20 21 22 23
24 25 26 27 28 29 30
31

最新コメント

[08/18 NONAME]
[05/18 NONAME]
[04/09 NONAME]
[03/21 NONAME]
[03/20 NONAME]

最新記事

ブログ内検索

広告

バーコード

広告