Bug 167660 - RTF export: Unicode is output unsigned
Summary: RTF export: Unicode is output unsigned
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:26.2.0
Keywords: filter:rtf
Depends on:
Blocks:
 
Reported: 2025-07-24 05:49 UTC by Mike Kaganski
Modified: 2025-07-24 08:00 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2025-07-24 05:49:45 UTC
Rich Text Format (RTF) Specification, Version 1.9.1, "Unicode RTF" ( original location https://www.microsoft.com/en-us/download/details.aspx?id=10725 ) explains, that the in \uN, N should be signed 16-bit value. However, we output it unsigned.

To test:

* Create a new text document;
* Put there a character from a range U+8000-U+FFFF; e.g., Liberation Sans has U+FB02 LATIN SMALL LIGATURE FL "fl";
* Export to RTF;
* Check the resulting RTF in a text editor.

Expected: \u-1278
Actual: \u64258

It doesn't create problems in Writer, and also doesn't seem problematic in Word; but better be closer to what Word itself outputs (and it indeed outputs signed 16-bit values).
Comment 1 Mike Kaganski 2025-07-24 06:31:03 UTC
https://gerrit.libreoffice.org/c/core/+/188257
Comment 2 Commit Notification 2025-07-24 08:00:04 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/c37b49d621537f623cea71ad8699e83248b169ac

tdf#167660: export \uN as signed 16-bit values

It will be available in 26.2.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.