Bug 142956 - LibreOffice Saving UTF-8 Plain Text Document as ANSI
Summary: LibreOffice Saving UTF-8 Plain Text Document as ANSI
Status: RESOLVED DUPLICATE of bug 120574
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.1.0.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-20 14:04 UTC by Truss
Modified: 2021-06-20 16:35 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
01 UTF-8 File Saved With Windows Notepad (31.43 KB, image/png)
2021-06-20 14:06 UTC, Truss
Details
02 File Opened in LibreOffice (38.25 KB, image/png)
2021-06-20 14:07 UTC, Truss
Details
03 File After Saving With LibreOffice (Notepad) (29.03 KB, image/png)
2021-06-20 14:07 UTC, Truss
Details
04 File After Saving With LibreOffice (VSCode) (56.48 KB, image/png)
2021-06-20 14:08 UTC, Truss
Details
File A - UTF-8 File Saved With Windows Notepad (40 bytes, text/plain)
2021-06-20 14:09 UTC, Truss
Details
File B - File After Saving With LibreOffice (38 bytes, text/plain)
2021-06-20 14:09 UTC, Truss
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Truss 2021-06-20 14:04:07 UTC
Description:
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.

https://bugs.documentfoundation.org/show_bug.cgi?id=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.

Actual Results:
LibreOffice 7.1 changes the encoding from UTF-8 (without BOM), to ANSI when saving.

Expected Results:
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).



Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.1.4.2 (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
Calc: threaded
Comment 1 Truss 2021-06-20 14:06:31 UTC
Created attachment 173030 [details]
01 UTF-8 File Saved With Windows Notepad
Comment 2 Truss 2021-06-20 14:07:22 UTC
Created attachment 173031 [details]
02 File Opened in LibreOffice
Comment 3 Truss 2021-06-20 14:07:50 UTC
Created attachment 173032 [details]
03 File After Saving With LibreOffice (Notepad)
Comment 4 Truss 2021-06-20 14:08:20 UTC
Created attachment 173033 [details]
04 File After Saving With LibreOffice (VSCode)
Comment 5 Truss 2021-06-20 14:09:24 UTC
Created attachment 173034 [details]
File A - UTF-8 File Saved With Windows Notepad
Comment 6 Truss 2021-06-20 14:09:50 UTC
Created attachment 173035 [details]
File B - File After Saving With LibreOffice
Comment 7 Mike Kaganski 2021-06-20 16:02:43 UTC

*** This bug has been marked as a duplicate of bug 120574 ***
Comment 8 Mike Kaganski 2021-06-20 16:35:25 UTC
Note also fix for tdf#142669, which implemented also keeping "without BOM" information.