Bug 127481

Summary: [GTK] webkit_web_view_load_html reads UTF8 css files as UTF16
Product: WebKit Reporter: Sami Wagiaalla <swagiaal>
Component: WebKit2Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: cgarcia, p.jacquemart
Priority: P3    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
a small test case
none
A partial back ported patch which fixes this issue none

Description Sami Wagiaalla 2014-01-23 08:13:19 PST
If you use webkit_web_view_load_html and provide an HTML string which contains links to css files webkit expects those files to be UTF16. Even if the default charset was set to UTF8.
Comment 1 Sami Wagiaalla 2014-01-23 08:14:47 PST
Created attachment 221983 [details]
a small test case
Comment 2 Pascal Jacquemart 2014-01-24 03:50:51 PST
Hi Samy,

I gave a quick try on your reduced test case but it seems to work properly for me. Launching your browser example and the text is actually displayed in blue
Am I missing something?
Comment 3 Sami Wagiaalla 2014-01-24 08:47:54 PST
Hi!

> I gave a quick try on your reduced test case but it seems to work properly for me. Launching your browser example and the text is actually displayed in blue

Hmm.. I did not expect that.
Which version of webkitgtk are you using ?

Is there any reason (setting on your environment) for your webkit to read the css file correctly as UTF8 ?

Just out of curiosity what happens of you replace the test.css file with test16.css file (mv test16.css test.css) ?

Strangely it turns out that if you specify @charset "UTF16" in the CSS file it is read properly.
Comment 4 Pascal Jacquemart 2014-01-24 09:24:44 PST
I tried with r162697 

Replacing test16.css to test.css give the same result: Big blue text
Of course while removing both .css files the text is flat

Maybe this issue is already fixed on the trunk?
Comment 5 Sami Wagiaalla 2014-01-24 10:06:59 PST
> Maybe this issue is already fixed on the trunk?

That would be great! Let me try trunk...
Comment 6 Sami Wagiaalla 2014-01-29 07:33:23 PST
Hi Pascal,

> > Maybe this issue is already fixed on the trunk? 
> That would be great! Let me try trunk...

Looks like you were right about this. The issue was fixed in revision 160572. Specifically http://trac.webkit.org/changeset/160572/trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

Any chance of back-porting that change to a stable release ?
Comment 7 Carlos Garcia Campos 2014-01-29 08:13:07 PST
Sure, added to the wiki https://trac.webkit.org/wiki/WebKitGTK/2.2.x
Comment 8 Sami Wagiaalla 2014-02-03 09:50:20 PST
Created attachment 222994 [details]
A partial back ported patch which fixes this issue
Comment 9 Sami Wagiaalla 2014-02-03 09:50:59 PST
(In reply to comment #7)
> Sure, added to the wiki https://trac.webkit.org/wiki/WebKitGTK/2.2.x

Thanks Carlos. I have attached the part of the patch which fixes this issue.
Comment 10 Carlos Garcia Campos 2014-02-18 03:06:21 PST
Committed in http://trac.webkit.org/changeset/164280. Thanks!
Comment 11 Sami Wagiaalla 2014-02-19 07:15:11 PST
> Committed in http://trac.webkit.org/changeset/164280. Thanks!

Sweet! Thanks Carlos!