When opening a plain text document (*.txt) that has been saved with UTF-8 (without BOM) encoding, LibreOffice 7.1 now correctly recognises the document's encoding due to the bug fix in bug 60145.
However, when making changes in LibreOffice and saving the file (CTRL + S), LibreOffice changes it to ANSI encoding, instead of keeping it as UTF-8 (without BOM).
I want to always save in UTF-8 (without BOM). Saving the file by going to [File > Save as > Text - Choose Encoding] is slow, impractical and relies on remembering to do it. I think LibreOffice needs a setting in [Tools > Options > Load/Save > General] that allows users to set the default encoding they want to use when saving plain text files – with the default setting being UTF-8 (without BOM).
Steps to Reproduce:
1) Create a new plain text document in a text editor, such as Windows Notepad or Visual Studio Code.
2) Add the below text, which contains en and em dashes.
En dash (–) test.
Em dash (—) test.
3) Save the file with UTF-8 (without BOM) encoding, which is the default in Windows Notepad and Visual Studio Code.
4) Open the file in LibreOffice, modify the document, then save the file [CTRL + S] or [File > Save].
5) Open the file in Windows NotePad. The encoding has been changed from UTF-8 (without BOM), to ANSI.
6) Open the file in Visual Studio Code. The text shows invalid characters if VSCode is set to use UTF-8 (without BOM), as the file is now ANSI.
LibreOffice 7.1 changes the encoding from UTF-8 (without BOM), to ANSI when saving.
LibreOffice should leave the encoding as UTF-8 (without BOM).
Or even better have an option in [Tools > Options > Load/Save > General] that allows users to set the default encoding they want to use when saving plain text files – with the default setting being UTF-8 (without BOM).
User Profile Reset: No
Version: 18.104.22.168 (x64) / LibreOffice Community
Build ID: a529a4fab45b75fefc5b6226684193eb000654f6
CPU threads: 4; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: en-GB (en_GB); UI: en-GB
Created attachment 173030 [details]
01 UTF-8 File Saved With Windows Notepad
Created attachment 173031 [details]
02 File Opened in LibreOffice
Created attachment 173032 [details]
03 File After Saving With LibreOffice (Notepad)
Created attachment 173033 [details]
04 File After Saving With LibreOffice (VSCode)
Created attachment 173034 [details]
File A - UTF-8 File Saved With Windows Notepad
Created attachment 173035 [details]
File B - File After Saving With LibreOffice
*** This bug has been marked as a duplicate of bug 120574 ***
Note also fix for tdf#142669, which implemented also keeping "without BOM" information.