[webkit-reviews] review requested: [Bug 26791] [Gtk] Paste of rich text from firefox results garbled markup : [Attachment 32238] use TextResourceDecoder instead of simple detectTextEncoding

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jul 3 08:33:33 PDT 2009


Jiahua Huang <jhuangjiahua at gmail.com> has asked  for review:
Bug 26791: [Gtk] Paste of rich text from firefox results garbled markup
https://bugs.webkit.org/show_bug.cgi?id=26791

Attachment 32238: use TextResourceDecoder instead of simple detectTextEncoding
https://bugs.webkit.org/attachment.cgi?id=32238&action=edit

------- Additional Comments from Jiahua Huang <jhuangjiahua at gmail.com>
change to this code:

>	  String html;
>	  RefPtr<TextResourceDecoder> decoder =
TextResourceDecoder::create("text/html", "UTF-8", true);
>	  html = decoder->decode(reinterpret_cast<char*>(data->data),
data->length);

it works.


GtkSelectionData (html) from GTK clipboard can be some forms:

 1. From other WebkitGtk page
    "text/html", 8bits, utf-8, no BOMs

 2. From FireFox page
    "text/html", 8bits (wrong for firefox), utf-16, BOMs

 3. From Pidgin messageview
    "text/html", 16bits, BOMs

 4. From other Gtk App who use "text/html" when copy-paste
    "text/html", 8bits, utf-8, no BOMs

 ...


it use TextResourceDecoder to auto detect encoding.


More information about the webkit-reviews mailing list