How to force LO to use non-UTF8 encoding for filenames?

Hi,

I’m using ISO encoding for user.
LO opens files from terminal without any issue, but when Save As is used LO saves file with filename being encoded in UTF-8 and does not follow user environment.

Even

G_BROKEN_FILENAMES=1 G_FILENAME_ENCODING=ru_RU.ISO8859-5 LANG=ru_RU.ISO8859-5 soffice --calc

with following ‘Save As’ will give filename in UTF-8

Funny tho ‘Save As’ dialog sees both ISO and UTF existing filenames in destination folder properly, but from Terminal UTF-8 names are broken.

Kubuntu 18.04 / Ubuntu Server 18.04

locale output looks like this

LANG=ru_RU.ISO8859-5
LANGUAGE=
LC_CTYPE=ru_RU.ISO8859-5
LC_NUMERIC="ru_RU.ISO8859-5"
LC_TIME="ru_RU.ISO8859-5"
LC_COLLATE="ru_RU.ISO8859-5"
LC_MONETARY="ru_RU.ISO8859-5"
LC_MESSAGES="ru_RU.ISO8859-5"
LC_PAPER="ru_RU.ISO8859-5"
LC_NAME="ru_RU.ISO8859-5"
LC_ADDRESS="ru_RU.ISO8859-5"
LC_TELEPHONE="ru_RU.ISO8859-5"
LC_MEASUREMENT="ru_RU.ISO8859-5"
LC_IDENTIFICATION="ru_RU.ISO8859-5"
LC_ALL=

Environment

env | grep -E "LANG|LC_"
LANGUAGE=
LANG=ru_RU.ISO8859-5
LC_CTYPE=ru_RU.ISO8859-5

Your system’s file dialog probably tries to guess the text encoding of file names. What does the output of the locale command in terminal say?

Updated original post with locale output

It would be also interesting to know LibreOffice version, and the VCL plugin it uses (so, simply full Help->About). The environment is likely KDE (Kubuntu)?

I remember that some time ago there were commits related to filenames encoding; it could be that more recent version of LO has it fixed?

(I suppose that “calc” is irrelevant here, since it’s likely a common problem)

Remote machines with Ubuntu Server have LibreOffice 6.0.7.3 00m0(Build:3). I’ve tried several, but none show menubar, so I can’t get to About window.

I have also a local machine with Kubuntu 20.10 and LibreOffice 7.0.3.1 00(Build:1) with VCL: kf5 which has the same problem with filenames encoding.

It is probably not related to the actual problem, but this specifying both

G_BROKEN_FILENAMES=1 G_FILENAME_ENCODING=ru_RU.ISO8859-5

is useless because G_FILENAME_ENCODING takes priority over G_BROKEN_FILENAMES. Note it only has an effect anyway on programs or parts that use glib, e.g. the environment’s file dialog.

I would think that those glib-related things would be irrelevant for kf5 (KDE integration plugin).

On “Ubuntu Server”, maybe F10 could bring the menu; if not, then you could add “Help->About” to any shown toolbar by right-clicking it, choosing “Customize Toolbar…”, and typing “about” into Search box on Toolbars tab in the dialog. I suspect that there you also use kf5, or maybe gen. Also it would be good to check if Options|LibreOffice|GeneralUse LibreOffice dialogs is checked for some reason, making LO use own custom file dialogs. Options are accessible using Alt+F12.

I’ve found one server that shows LO with menubar. Saw no difference in list of installed packets with other servers tho. There is also no diff in envs.
6.0.7.3 VCL: gtk3

I’ve turned on ‘Use LibreOffice dialogs’ in Options and not only do they look better now, but LO now also follows system variables and resulted name after ‘Save As’ seems fine.
There is also no guessing filename encodings. If it is in UTF-8 LO save dialog displays it in unreadable format, which is fine once again.

Can this be set from command line? I have multiple profile folders (pretty much dynamic profile folders) so that one instance of LO will not block launching another instance of LO.

Is the keyboard not managed by the operating system? I use the KEYBOARD command to control the keys on my Linux Mint system.

What do you mean by using ISO encoding for user? Do you mean ISO-8859-5? If so, how does the system know?

The keyboard is not the problem. It’s the text encoding of file names, and that’s entirely up to applications and libraries as the kernel or file system has no notion whatsoever about file name encoding, for them it’s just a string of bytes.

Can this be set from command line?

No, but it can be configured in the user profile’s registrymodifications.xcu if you add an item

<item oor:path="/org.openoffice.Office.Common/Misc"><prop oor:name="UseSystemFileDialog" oor:op="fuse"><value>false</value></prop></item>

to the <oor:items> element.

Nevertheless, if it’s working with the internal file dialog then it’s even more likely that it’s a bug with interfacing to the gtk3 or kf5 dialog and you could submit it.

After several hours I’ve made a global conf file /usr/lib/libreoffice/share/registry/custom.xcd

<?xml version="1.0"?>
<oor:data xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oor="http://openoffice.org/2001/registry">
<dependency file="main"/>
<oor:component-schema oor:package="org.openoffice.Office" oor:name="Common" xml:lang="en-US">
<component>
<group oor:name="Misc">
<prop oor:name="UseSystemFileDialog" oor:type="xs:boolean" oor:nillable="false" oor:op="replace"><value>false</value></prop>
</group>
</component>
</oor:component-schema>
<oor:component-data xmlns:install="http://openoffice.org/2004/installation" oor:name="Common" oor:package="org.openoffice.Office">
<node oor:name="Misc">
<prop oor:name="UseSystemFileDialog" oor:type="xs:boolean" oor:nillable="false"><value>false</value></prop>
</node>
</oor:component-data>
</oor:data>

To sum things up from comments

Based on a comment of Mike Kaganski it happens so that enabling LO’s own Save dialog instead of system one via Options|LibreOffice|General->Use LibreOffice dialogs is one possible workaround. It works with env locale correctly.

Further, as mentioned by erAck it can be set in user profile registrymodifications.xcu by adding following item

<item oor:path="/org.openoffice.Office.Common/Misc"><prop oor:name="UseSystemFileDialog" oor:op="fuse"><value>false</value></prop></item>

It can also be set globally via /usr/lib/libreoffice/share/registry/custom.xcd and

<?xml version="1.0"?>
<oor:data xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oor="http://openoffice.org/2001/registry">
<dependency file="main"/>
<oor:component-schema oor:package="org.openoffice.Office" oor:name="Common" xml:lang="en-US">
<component>
<group oor:name="Misc">
<prop oor:name="UseSystemFileDialog" oor:type="xs:boolean" oor:nillable="false" oor:op="replace"><value>false</value></prop>
</group>
</component>
</oor:component-schema>
<oor:component-data xmlns:install="http://openoffice.org/2004/installation" oor:name="Common" oor:package="org.openoffice.Office">
<node oor:name="Misc">
<prop oor:name="UseSystemFileDialog" oor:type="xs:boolean" oor:nillable="false"><value>false</value></prop>
</node>
</oor:component-data>
</oor:data>

Nice!

Still it would be very useful to file it as a bug, with detailed configuration (OS, VM, language/locale settings, LO settings, filenames, visible results in OS file managers and in LO dialogs).

Not sure if this is supposed to work at all, but the gtk3 file picker or the part of LibreOffice interfacing it obtaining the name apparently does not take non-UTF-8 encodings. May be worth to submit a bug.