Bug 152694

Summary: Problem copying text from Writer to TRichViewEdit (.rtf) or WordPad
Product: LibreOffice Reporter: Anton <voskovshuk.a>
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: NEW ---    
Severity: normal CC: ilmari.lauhakangas
Priority: medium Keywords: bibisected, regression
Version: 4.4.0.3 release   
Hardware: All   
OS: Windows (All)   
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 109040    
Attachments: in the archive description of the problem with screenshots and files from the description
Short video of inserting text in WordPad

Description Anton 2022-12-27 06:29:26 UTC
Description:
We have a problem using Libre Office Writer in conjunction with our Delphi-based Medical Inormation System (MIS). 
Some doctors previously used to keep their exam protocols (in Cyrillic codepage) in .ODT files, and now copy/paste some pieces of text from these files into fields of MIS screen forms. In some cases they get garbaged text there.

We’ve investigated this situation and are able to provide detailed information in order to ask you to fix this problem. Description follows.


Steps to Reproduce:
There is some .ODT file
1. There is some .ODT file. I open it with Writer, copy the contents.
2. I paste it into the RTF text editor window in our MIS (which is based on TRichViewEdit – Delphi environment component) - there is no problem yet, text is pasted as expected.
3. Then in Writer editor I change font of the source text from Times New Roman to any other font with Cyrillic codepage, even to the same Times New Roman.
4. After this I copy the same text, paste it into the same RTF editor windiw, but in this case the font and non-printable characters look differently.
Moreover, if I then change font to any other in TRichViewEdit editor window, all the consequent chars are inserted in Japaneese codepage.
5.  In order to investigate the issue I save this test to file 1.rtf and then open it with Notepad++, plain test editor. The picture is as  follows.
For the first time the text was copied using the font \f1 with the attribute \lang1049, that corresponds to Cyrillic codepage. The second time, after I’ve changed the font, the text was pasted using the font \f2 with attribute \lang1041 (Japanese language) fcharset128 (Japanese codepage). It seems this fact causes the text to be garbaged.

Actual Results:
After I’ve changed the font, the text was pasted using the font \f2 with attribute \lang1041 (Japanese language) fcharset128 (Japanese codepage).

Expected Results:
After changing the font, the text will be inserted in the \f1 font with the \lang1049 attribute, which corresponds to the Cyrillic code page.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Version: 7.3.7.2 (x64) / LibreOffice Community
Build ID: e114eadc50a9ff8d8c8a0567d6da8f454beeb84f
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: ru-RU (ru_RU); UI: ru-RU
Calc: threaded
Comment 1 Anton 2022-12-27 06:35:05 UTC
Created attachment 184362 [details]
in the archive description of the problem with screenshots and files from the description
Comment 2 Dieter 2022-12-30 09:16:09 UTC
(In reply to Anton from comment #0)
> Description:
> We have a problem using Libre Office Writer in conjunction with our
> Delphi-based Medical Inormation System (MIS). 

I don't think, that somebody could confirm the bug, because I don't think, that anybody here uses your Medical Information System (MIS).

So any chance to reproduce the bug without using that program?
=> NEEDINFO
Comment 3 Anton 2022-12-30 11:20:31 UTC
(In reply to Dieter from comment #2)
> (In reply to Anton from comment #0)
> > Description:
> > We have a problem using Libre Office Writer in conjunction with our
> > Delphi-based Medical Inormation System (MIS). 
> 
> I don't think, that somebody could confirm the bug, because I don't think,
> that anybody here uses your Medical Information System (MIS).
> 
> So any chance to reproduce the bug without using that program?
> => NEEDINFO

Something similar can be seen when pasting text into WordPad.
Added a short video of inserting text in WordPad.
Comment 4 Anton 2022-12-30 11:22:07 UTC
Created attachment 184394 [details]
Short video of inserting text in WordPad
Comment 5 QA Administrators 2022-12-31 03:19:47 UTC Comment hidden (obsolete)
Comment 6 Buovjaga 2023-03-14 13:58:49 UTC
I bibisected this with win32-4.4 to the range
https://cgit.freedesktop.org/libreoffice/core/log/?qt=range&q=8ff029893ec9ad3e9811eb6107768156d48a997a..4ed5bacc86e0137d9ace5a2ceda09c2393716793

I wonder, if it's one of the RTF-related ones like "fdo#77979: sw: RTF export: write non-ASCII font names encoded".

Would be nice to have some way to reproduce this on Linux, so this could be pinpointed with linux-44max repository. I didn't even try, though.