Bug 35635 - [Qt] copy and paste greek symbols to Word, TextEdit results in ?'s being shown
Summary: [Qt] copy and paste greek symbols to Word, TextEdit results in ?'s being shown
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: QtWebKit Unassigned
URL:
Keywords: Qt
Depends on:
Blocks:
 
Reported: 2010-03-03 03:17 PST by Tor Arne Vestbø
Modified: 2010-12-23 13:08 PST (History)
4 users (show)

See Also:


Attachments
Patch (2.56 KB, patch)
2010-12-12 09:04 PST, Jan Erik Hanssen
no flags Details | Formatted Diff | Diff
Patch (4.21 KB, patch)
2010-12-22 12:24 PST, Jan Erik Hanssen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tor Arne Vestbø 2010-03-03 03:17:08 PST
This bug report originated from issue QTBUG-8429
http://bugreports.qt.nokia.com/browse/QTBUG-8429

--- Description ---

I'm not sure if this is a Qt or a webkit issue, and there is a Qt twist, so I'm posting it here:

<p>-create an editable QWebView<br/>
-insert some greek letters (e.g. αβγδεζηθικλμπ)<br/>
-select them<br/>
-do a Copy<br/>
-open up Word or TextEdit.app and paste</p>

<p>You get ?'s, instead of the greek letters. Strangly other editors, like QtCreator and Smultron have no trouble displaying them.</p>

<p>Theory: the data is on the clipboard just fine, but the encoding is not being included.</p>

<p>I found a hacky workaround: use QClipboard to push the data back on again like so:</p>

<p>  //something is goofy with the encoding, so copy again using QClipboard directly...<br/>
  qApp-&gt;clipboard()<del>&gt;setText( qApp</del>&gt;clipboard()-&gt;text() );</p>

<p>This actually works, but in order to trap a slew of copy calls you have to do stuff like reimplement QWebView's keyPressEvent function.</p>
Comment 1 Kent Hansen 2010-03-16 06:05:17 PDT
Reproduced with r55986, http://html5demos.com/contenteditable
Comment 2 Jan Erik Hanssen 2010-12-12 08:58:39 PST
This is caused by Pasteboard::writeSelection() calling QMimeData::setHtml() and there's two separate issues involved here.

1) QMacPasteboardMimeAny::convertFromMime() returns UTF-8 data only for text/plain, not text/html. Not sure if this is intended or not but I don't think it can be changed in Qt without breaking existing code.

2) HTML on the Pasteboard on OS X needs to be explicitly told that it contains unicode data (i.e. using a <meta> tag).

I'll upload a patch shortly that fixes this.
Comment 3 Jan Erik Hanssen 2010-12-12 09:04:12 PST
Created attachment 76329 [details]
Patch
Comment 4 Eric Seidel (no email) 2010-12-13 00:43:01 PST
Comment on attachment 76329 [details]
Patch

Seems you'd want to share more code with PasteboardMac here. :(
Comment 5 Eric Seidel (no email) 2010-12-13 00:43:37 PST
Comment on attachment 76329 [details]
Patch

We really need a better way of testing clipboard tests like this.
Comment 6 Jan Erik Hanssen 2010-12-13 01:37:43 PST
(In reply to comment #5)
> (From update of attachment 76329 [details])
> We really need a better way of testing clipboard tests like this.

Agreed. This particular one would be hard to test though since this bug only happens when copying from QtWebKit and pasting to a non-Qt program so I don't see how this could be tested without launching an external application.
Comment 7 Jan Erik Hanssen 2010-12-22 12:24:14 PST
Created attachment 77245 [details]
Patch

Change the manual test case in the previous test to an autotest for Qt which checks that QClipboard contains the selected unicode data and also verifies that the clipboard data contains the charset information
Comment 8 Ariya Hidayat 2010-12-22 15:10:51 PST
> Seems you'd want to share more code with PasteboardMac here. :(

This bug is caused by Qt-specific handling in its QClipboard abstraction.
Comment 9 Andreas Kling 2010-12-23 11:43:03 PST
Comment on attachment 77245 [details]
Patch

Looks sane enough to me.
Comment 10 WebKit Commit Bot 2010-12-23 13:07:09 PST
The commit-queue encountered the following flaky tests while processing attachment 77245 [details]:

http/tests/appcache/local-content.html bug 51558 (author: ap@webkit.org)
The commit-queue is continuing to process your patch.
Comment 11 WebKit Commit Bot 2010-12-23 13:08:25 PST
Comment on attachment 77245 [details]
Patch

Clearing flags on attachment: 77245

Committed r74577: <http://trac.webkit.org/changeset/74577>
Comment 12 WebKit Commit Bot 2010-12-23 13:08:32 PST
All reviewed patches have been landed.  Closing bug.