Bug 151370 - FILEOPEN RTF Document variables with accented characters in their name/value imported incorrectly
Summary: FILEOPEN RTF Document variables with accented characters in their name/value ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.5.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Vasily Melenchuk (CIB)
URL:
Whiteboard: target:7.5.0 target:7.4.3
Keywords:
Depends on:
Blocks: RTF-Fields
  Show dependency treegraph
 
Reported: 2022-10-06 09:03 UTC by Gabor Kelemen (allotropia)
Modified: 2022-10-10 08:39 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Example file with accented characters in docvariable (41.27 KB, application/msword)
2022-10-06 09:03 UTC, Gabor Kelemen (allotropia)
Details
How the docvar looks in Word 2016 and Writer (88.53 KB, image/png)
2022-10-06 09:03 UTC, Gabor Kelemen (allotropia)
Details
Docm file used to generate the variable (18.30 KB, application/vnd.ms-word.document.macroEnabled.12)
2022-10-06 09:08 UTC, Gabor Kelemen (allotropia)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2022-10-06 09:03:11 UTC
Created attachment 182851 [details]
Example file with accented characters in docvariable

This is a followup to bug 150267

When a document variable contains accented characters in the name or value, the import is incorrect and only the part starting with the last accented character is imported.

1, Open attached RTF file in Word and then in Writer
2/a, In Word go to the Developer ribbon, Visual Basic button
2/b, Under ThisDocument create and run the following macro:

Sub GetSetDocVars()
   For Each myVar In ActiveDocument.Variables
       MsgBox "Name =" & myVar.Name & vbCr & "Value = " & myVar.Value
   Next myVar
End Sub

This should print in the popup dialog the name (LocalCharsÁrvízturoTükörfúrógép) and value (árvízturo tükörfúrógép) of the document variable, full of accented characters.

3/a In Writer go to the Fields dialog (Ctrl-F2) and to Variables tab - User field type.
3/b Observe the name and value is just "ép" so the last two chars.

Version: 7.5.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: cc038c471e96d766db404388b140364614898bf2
CPU threads: 14; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: en-US (hu_HU); UI: en-US
Calc: threaded
Comment 1 Gabor Kelemen (allotropia) 2022-10-06 09:03:41 UTC
Created attachment 182852 [details]
How the docvar looks in Word 2016 and Writer
Comment 2 Gabor Kelemen (allotropia) 2022-10-06 09:08:11 UTC
Created attachment 182853 [details]
Docm file used to generate the variable

Unfortunately this is saved to RTF with 1252 encoding, so I could not use őű chars :(.
Comment 3 Commit Notification 2022-10-07 09:07:09 UTC
Vasily Melenchuk committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/0d545f1f0afc93bd568f8172a134ab9196529809

tdf#151370: RTF import: docvar name/value can have several sequences

It will be available in 7.5.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 4 Commit Notification 2022-10-10 08:39:59 UTC
Vasily Melenchuk committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

https://git.libreoffice.org/core/commit/564ec69c3d2cf591c80dbb561bf04fe3c6180f31

tdf#151370: RTF import: docvar name/value can have several sequences

It will be available in 7.4.3.

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.