Bug 166756 - The file name in the header uses URL (percent) encoding
Summary: The file name in the header uses URL (percent) encoding
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
24.8.6.2 release
Hardware: x86-64 (AMD64) All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard: target:26.8.0
Keywords: difficultyBeginner, easyHack, skillCpp
Depends on:
Blocks: Writer-Header-Footer
  Show dependency treegraph
 
Reported: 2025-05-28 05:34 UTC by Peter
Modified: 2026-02-07 15:23 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
My test file. You can preview upper header to see UTF-8 codes. (11.40 KB, application/vnd.oasis.opendocument.spreadsheet)
2025-05-28 05:41 UTC, Peter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter 2025-05-28 05:34:49 UTC
Description:
If the file name contains symbols and you paste it file name into the header footer (used Menu\Format\Page style\...\FileName fields), some of them - "#", "%", "[" and "]", printed or previewed as UTF-8 code: %23, %25, % 5B, %5D

Steps to Reproduce:
1. Create file with the symbol  "[", "]", "#", "%" in the file name.
2. Insert its FileName in the upper footer with "Menu\Format\Page style\Upper footer\Edit\FileName field".
3. Preview or print file.

Actual Results:
symbols "[" "]" "#" "%" printing or previewed as UTF-8 codes

Expected Results:
symbols "[" "]" "#" "%" printing or previewed as symbols


Reproducible: Always


User Profile Reset: No

Additional Info:
1) I have a file: "[1] name_of_file.xlsx", (or "*.ods" - it is not matter).
When I printed it, I saw that the characters "[" and "]" were printed as "%5B" and "%5D". As it turned out, this is also visible when previewing the page.

2) I created a file named: "1-=!@#$%^&*()_+|{}[] name_file.ods" and saw that symbols "#", "%", "[" and "]" previewing or printing in the header footer in UTF-8: %23, %25, %5B, %5D
Comment 1 Peter 2025-05-28 05:41:36 UTC
Created attachment 200988 [details]
My test file. You can preview upper header to see UTF-8 codes.
Comment 2 Mike Kaganski 2025-05-28 08:57:25 UTC
Code pointer: SvxExtFileField::GetFormatted in editeng/source/items/flditem.cxx. It should fix handling of SvxFileFormat::NameOnly and SvxFileFormat::NameAndExt, where it uses wrong decode mechanism.
Comment 3 Mike Kaganski 2025-06-26 08:29:18 UTC
Let me update the code pointer. It turns out, that Calc has a separate function for its fields content; look at ScHeaderEditEngine::CalcFieldValue.
Comment 4 didier-devel 2026-01-01 14:58:43 UTC
Hello. I added that patch to gerrit https://gerrit.libreoffice.org/c/core/+/196392
Comment 5 Commit Notification 2026-01-29 10:48:40 UTC
Didier Vidal committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/540d53505863665c43f1d4960c33bf960c543cdc

tdf#166756 Do not use URL encoding for file name in header and footer

It will be available in 26.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.
Comment 6 Buovjaga 2026-01-29 10:52:20 UTC
(In reply to didier-devel from comment #4)
> Hello. I added that patch to gerrit
> https://gerrit.libreoffice.org/c/core/+/196392

Feel free to close the report as fixed.