command line conversion - encoding changes from UTF8 to 'Non-ISO extended-ASCII'

I have some XLS files. I was using LO for editing them and Gnumeric’s ssconvert tool for doing command line conversions of them into CSV (which I need for reasons outside the scope of this post).

For reasons of convenience/cleanliness, I would like to use LO for doing both. So now I’m trying to use this command to do the conversion:

libreoffice -env:UserInstallation=file:///home/$USER/.libreoffice-alt --headless --convert-to csv  <my-xls-file>

(’-env:…’ is to ensure this LO instance does something even though I already have LO GUI open.)

This command gives almost the same results as ssconvert, except that the encoding has changed; with ssconvert output looked like this:

…,“Stechlinseestraße 999”,…

with libreoffice output looks like this:

…,“Stechlinseestra�e 999”,…

According to the ‘file’ command the encoding has changed from:

UTF-8 Unicode text

to one of:

ISO-8859 text
Non-ISO extended-ASCII text

(The encoding of the ssconvert-converted files is always UTF-8, but the encoding of the libreoffice-converted files varies, presumably depending on the characters in the various input files, which include text written in German, Czech, Slovak, Danish, Hungarian.)

I did find some references to the output encoding being derived from the locale, but prefixing the conversion command with:

LC_ALL=en_US.UTF-8 LANGUAGE=en_US.UTF-8

made no difference. Anybody any ideas how to enforce UTF-8 output encoding? Thanks!

For info, this is on an Ubuntu 14.04.2 system, LO is 4.2.7.2 Build ID: 420m0(Build:2).

Here’s what I found:

libreoffice -env:UserInstallation=file:///home/$USER/.libreoffice-alt --headless --convert-to "csv:Text - txt - csv (StarCalc):44,34,76,1,1/1" <my-xls-file>

that’s where:

  1. libreoffice --help
  2. Filter Options - Apache OpenOffice Wiki

Also refer examples under v4.4 using the --infilter argument in bug fdo#36313 e.g., CSV:44,34,UTF8.

Thanks, but unfortunately, that seems not to work in the LO version I specified. Both sets of infilter arguments produce:

libreoffice -env:UserInstallation=file:///home/$USER/.libreoffice-alt --headless --convert-to "csv:Text - txt - csv (StarCalc):44,34,76,1,1/1"  <my-xls-file>
    convert <my-xls-file> -> <my-csv-file> using Text - txt - csv (StarCalc):44,34,76,1,1/1
Error: Please reverify input parameters...

Note that the --infilter options are for input files, not output.