Bug 165564 - Corrupted endnotes and footnotes after saving and opening as RTF
Summary: Corrupted endnotes and footnotes after saving and opening as RTF
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.3.0.4 release
Hardware: All All
: medium normal
Assignee: Oliver Specht (CIB)
URL:
Whiteboard: target:25.8.0
Keywords: bibisected, bisected, filter:rtf, regression
Depends on:
Blocks: RTF-Footnote-Endnote
  Show dependency treegraph
 
Reported: 2025-03-04 08:53 UTC by Marco
Modified: 2025-05-18 08:39 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file (13.13 KB, application/vnd.oasis.opendocument.text)
2025-03-04 08:56 UTC, Marco
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marco 2025-03-04 08:53:52 UTC
Description:
Endnotes at the beginning of the line get an additional space when saved in rtf format.
Special endnotes add an unwanted duplicate reference marker character. Special endnotes at the beginning of the line also add the the reference character to the text of the endnote.
The additional space at the beginning of the line is added when the file is saved.
Other errors are introduced when the file is read.

Steps to Reproduce:
1. New File
2. Type any text
3. Insert an endnote
4. Save as rtf
5. Close file
6. Open the saved file

Actual Results:
Unwanted characters and spaces both in the reference and in the text of the endnote

Expected Results:
Open the file as I saved it


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Version: 25.2.1.2 (X86_64) / LibreOffice Community
Build ID: d3abf4aee5fd705e4a92bba33a32f40bc4e56f49
CPU threads: 16; OS: Windows 11 X86_64 (10.0 build 26100); UI render: Skia/Raster; VCL: win
Locale: it-IT (it_IT); UI: it-IT
Calc: CL threaded
Comment 1 Marco 2025-03-04 08:56:04 UTC
Created attachment 199593 [details]
Example file

Save file as RTF and reopen
Comment 2 raal 2025-03-09 08:14:51 UTC
Confirm with Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 7c806a668530f25730717a12e6f97972f69d9c09
CPU threads: 4; OS: Linux 6.8; UI render: default; VCL: gtk3
Locale: cs-CZ (cs_CZ.UTF-8); UI: en-US
Calc: threaded
Comment 3 Telesto 2025-05-01 10:34:18 UTC
I looked at the duplication of the endnote. So * being part of the list as endnote text. 

I haven't looked at the extra space in the main text 

Found in
Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: feb3c03b70ac1534a187e390c3bc1604a919ce12
CPU threads: 4; OS: Windows 10 X86_64 (build 19045); UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL threaded

and in
Versie: 6.3.0.4 (x86)
Build ID: 057fc023c990d676a43019934386b85b21a9ee99
CPU-threads: 4; Besturingssysteem: Windows 10.0; UI-render: GL; VCL: win; 
Locale: nl-NL (nl_NL); UI-taal: nl-NL
Calc: CL

Fine with
Version: 6.1.6.3
Build ID: 5896ab1714085361c45cf540f76f60673dd96a72
CPU threads: 4; OS: Windows 10.0; UI render: default; 
Locale: nl-NL (nl_NL); Calc: CL

It appears there multiple issue here. Caused by import at the one hand. Export at the other. 

I reported Indent lacking for endnote on RTF import separately (bug 166420). This bug appears to be younger.
Comment 4 Saburo 2025-05-02 10:08:25 UTC
Bisected
Version: 6.3.0.0.beta1+ (x86)
Build ID: 3c1f6fc029ab8ff9129f2316a3d7c81bc7b69125

author	Serge Krot <Serge.Krot@cib.de>
commit 3c1f6fc029ab8ff9129f2316a3d7c81bc7b69125

tdf#125719 sw: rtf: refactor associated character properties
1. \rtlch, \ltrch should be placed before their properties.
2. Do not mix associated and normal character properties in output.
3. Do not output empty "\rtlch \ltrch", "\ltrch \rtlch" pairs.
4. Handle associated character properties runs instead of
handling separately their parts without order of them.

Change-Id: Ibbf7365d04708682a5f1eb664a579c60a47465d2
Reviewed-on: https://gerrit.libreoffice.org/72578
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
(cherry picked from commit fd95fb975b754d71d3750e85431a4e596a40e659)
Reviewed-on: https://gerrit.libreoffice.org/73868
Comment 5 Oliver Specht (CIB) 2025-05-05 15:31:59 UTC
The error while loading footnotes with custom symbols has been introduced with 
commit 6fd2bb9b8967c4945550b0f7b7541aaace8020c1
Author: László Németh <nemeth@numbertext.org>
Date:   Mon Apr 19 17:52:17 2021 +0200

    tdf#141548 DOCX import: fix lost text after endnoteRef
Comment 6 Commit Notification 2025-05-08 09:38:47 UTC
Oliver Specht committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/90ce84a5dd371c804af19e97896a5e19a3ebf8ca

tdf#165564 RTF:Fix export and import of footnotes/endnotes

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.