3

unoconv uses LibreOffice to convert any file that LibreOffice can convert.

Now I need export to text with the UTF-8 character encoding.

I use the following command:

unoconv -f txt -e FilterOptions=76 Foo.docx

This creates the Foo.txt file, but its encoding is us-ascii and the characters don't show correctly.

If I'm right, the -e option sets the export filtering options as the man page mentions. What's wrong with my options?

Example of input and output files:

2
  • 1
    What's an example of a character that isn't converted correctly? What is it converted to? Ideally, post a link to an example of a small document (with just one word or so) that doesn't convert correctly. Aug 23, 2014 at 13:00
  • @Gilles: Thanks for your attention. I added the example files. Aug 23, 2014 at 13:23

1 Answer 1

3

Try:

unoconv -f txt -e FilterOptions=UTF8,LF Foo.docx

It seems a bug and was reported here.

If it doesn't work, maybe your LibreOffice doesn't support docx file. See more details here.

6
  • Many thanks @Gnouc, But this does not change the Foo.txt character encoding. still it's us-ascii. Aug 23, 2014 at 7:53
  • @MohammadEtemaddar: Maybe your LibreOffice does not support docx file. See my updated answer.
    – cuonglm
    Aug 23, 2014 at 8:09
  • I use LibreOffice 4.3 and it supports .docx; I could convert .docx to .odt and also .odt file has the same issue. Aug 23, 2014 at 11:39
  • This works for me. unoconv 0.5-1 on Debian Gnu+Linux Aug 23, 2014 at 23:26
  • Thanks @richard, Compilation got error on Slackware current. But I could convert .docx to .txt using pyton-docx. We can also convert .odt to .docx and then covert it to .txt with UTF-8 encoding. Aug 24, 2014 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.