Ask Your Question
0

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

asked 2015-03-13 12:38:00 +0200

Alexis Huxley gravatar image

updated 2015-03-13 13:10:06 +0200

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).

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2015-03-13 14:42:42 +0200

LogicDaemon gravatar image

updated 2015-03-13 14:43:50 +0200

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. https://wiki.openoffice.org/wiki/Docu...
edit flag offensive delete link more

Comments

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

oweng gravatar imageoweng ( 2015-03-14 03:28:24 +0200 )edit

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...
Alexis Huxley gravatar imageAlexis Huxley ( 2015-03-16 08:13:12 +0200 )edit

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

erAck gravatar imageerAck ( 2017-07-19 11:29:31 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-03-13 12:38:00 +0200

Seen: 4,844 times

Last updated: Mar 13 '15