我将尝试翻译您的内容:
我正在尝试在我的Linux服务器上使用antiword解析MS Office 2003文档。但它无法正确解析西里尔文本。
它返回类似于这样的结果:
??? ???? ???????????
有人知道如何正确解析包含西里尔文本的MS Office 2003文档吗?
我正在尝试在我的Linux服务器上使用antiword解析MS Office 2003文档。但它无法正确解析西里尔文本。
它返回类似于这样的结果:
??? ???? ???????????
有人知道如何正确解析包含西里尔文本的MS Office 2003文档吗?
我解决了这个西里尔文文本问题
你可以在这里看到良好的文档
下面是可工作的代码:
$content = shell_exec('/usr/bin/antiword -m cp1251.txt '.$filename);
var_dump($content);
请注意参数 -m(字符映射文件)
您忘记设置正确的映射文件了
这段文档涉及到文件映射:
Q9: Which mapping file (-m option) is correct in my situation?
A9: The correct mapping file depends on the character set you need for output
in a specific language.
For Western European languages (like English, French, German) this is
8859-1.txt. (OS/2: cp1252.txt) (DOS: cp850.txt)
For Eastern European languages (like Polish, Czech, Slovak, Croatian) this
is 8859-2.txt. (OS/2: cp1250.txt) (DOS: cp852.txt)
For Esperanto use 8859-3.txt.
For Russian use 8859-5.txt or koi8-r.txt. (OS/2: cp1251.txt)
(DOS: cp866.txt)
For Ukrainian use koi8-u.txt.
For Arabic use 8859-6.txt. (DOS: cp864.txt)
For Hebrew use 8859-8.txt. (DOS: cp862.txt)
For Thai use 8859-11.txt.
If your system supports it, you might also try UTF-8.txt.
NOTE: UTF-8 also enables Antiword to show text in languages like Chinese,
Japanese and Korean.
Antiword有一个编码参数,也许你可以尝试一下:
shell_exec('antiword -X UTF-8 test.doc')
或者使用koi8-r
,然后通过iconv()
在php中进行转换。
或者尝试在命令行模式下使用LibreOffice
shell_exec('soffice --headless --convert-to txt test.doc')
0.32
,它是从2001年的。 - mario
antiword test.doc
命令,而在我的 PHP 代码中,我使用相同的方式shell_exec('antiword test.doc')
。 - vladimir??? ???? ???????????
。 - vladimir??? ???? ???????????
。 - vladimir