Issue 120442

Summary: Copy text to Firefox or Chrome cause data damaged
Product: Writer Reporter: Yan Ji <yanji.yj>
Component: editingAssignee: AOO issues mailing list <issues>
Status: CLOSED FIXED QA Contact:
Severity: Normal    
Priority: P3 CC: bjdujing, chenpeng2006, hdu, rb.henschel
Version: 3.4.0   
Target Milestone: 4.0.0   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Issue Depends on:    
Issue Blocks: 102943    
Attachments:
Description Flags
sample
none
Patch for 120442 hdu: review+

Description Yan Ji 2012-08-02 06:48:42 UTC
Created attachment 78816 [details]
sample

Build AOO 3.4.1
OS: All
Steps:
1. Open attached sample file
2. Select content of line 8
3. Paste it to edit field in Firefox, Chrome or Safari. e.g. in memo of gmail

Defect: the content is not pasted correctly.
Comment 1 Chen Peng 2012-08-02 08:20:59 UTC
I will take this bug, thanks.
Comment 2 Regina Henschel 2012-08-02 13:38:57 UTC
I think, that a browser is not suitable to examine, whether AOO uses the clipboard correctly. The character set and the font of a displayed website depends on the settings of the browser and the settings in the website.
Comment 3 Chen Peng 2012-08-07 07:59:06 UTC
1. Root Cause:
  In Firefox or Chrome, if the unicode is equal or larger than 0xd800 and smaller equal or than 0xdbff, and the next unicode is equal or larger then 0xdc00 and equal or smaller than 0xdfff, using such two 16-bit unicode can't display the data such as the last 5 charaters of line 8 in the sample. 
2. Resolution:
Need to convert such two 16-bit unicode to a 32-bit unicode to show the content.
Comment 4 Chen Peng 2012-08-07 08:02:48 UTC
Created attachment 78870 [details]
Patch for 120442
Comment 5 Chen Peng 2012-08-07 08:16:22 UTC
It is correct if paste such content in IE or MS. The content of last 5 characters in clipboard is using two 16-bit unicode format, but paste such content in Chrome, Firefox or Safari, it is wrong, need to change the two 16-bit unicode to a 32-bit unicode to show the right content. 
(In reply to comment #2)
> I think, that a browser is not suitable to examine, whether AOO uses the
> clipboard correctly. The character set and the font of a displayed website
> depends on the settings of the browser and the settings in the website.
Comment 6 SVN Robot 2012-08-08 09:32:13 UTC
"hdu" committed SVN revision 1370716 into trunk:
#i120442# fix html-flavored copy+paste of unicode surrogate pairsPatch-by: Ch...
Comment 7 hdu@apache.org 2012-08-08 09:34:26 UTC
Thanks for finding, analyzing and solving the problem. I reviewed and applied the patch with some minor modifications.
Comment 8 Chen Peng 2012-08-09 00:50:14 UTC
Thank you, Herbert. It is more clear now.
Comment 9 Du Jing 2012-08-30 08:44:12 UTC
verified on the build r1378446