Is there a way to set LO to open text files as UTF-8 or to default to txt (Choose Encoding)?

When I open txt files many characters get garbled because they are UTF-8 encoded. I would like to have LO default to using UTF-8 when opening text files (like OpenOffice does) or at least have it pop up the ‘select encoding’ box. There are so many options under ‘file type’ when opening files that I can’t find what I want.

When you say that you open txt files you mean from within LibreOffice or by double clicking them?

Choose the file type 'Text - (Choose encoding) (*.txt)

I am aware of that method. what I am looking for is a way to make that the default like OpenOffice does instead of having to go through the filetype pulldown. Since almost ALL of the text files I am working with are UTF-8 encoded, it is a pain having to go through the filetype pulldown every time. Having a config setting for how text files are opened would be nice.

Then maybe you can find a solution in this thread Change text encoding for reading from text file (Macro)

Creating a “shortcut” with hardcoded filter, and using it for those files, could be an option. E.g., on Windows, you may create a shortcut on desktop having command line like

"C:\Program Files\LibreOffice\program\soffice.exe" --infilter="Text (encoded)"

and drag TXT files onto it to have the “ASCII Filter Options” dialog shown. You may also add filter options to the command above to fix to using UTF-8 - see --infilterin the relevant help.

1 Like

I was dealing with the same problem today. LibreOffice opens and saves TXT files with locale encoding (Windows ANSI 1250 Eastern Europe) on my Windows 7 and with Unicode encoding (UTF-8) on my Windows 10.

I solved this by forcing an encoding selection dialog when opening each TXT file.

In the registries I added to the key
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\soffice.StarWriterDocument.6\shell\open\command

parameter
--infilter="Text (encoded)"

and now there it is
"C:\Program Files\LibreOffice\program\soffice.exe" -o --infilter="Text (encoded)" "%1"

It seems to work :slight_smile:

Is that the same version of LibreOffice on your Windows 7 and Windows 10? Because we changed this ~recently (tdf#60145 in v.7.1, tdf#120574 in v.7.2), making encoding detection better, and opened text files remember their encoding. So it’s not “Win7 vs. Win10”, but “old LO vs. new LO”.

1 Like