[Webkit-unassigned] [Bug 17732] An external JavaScript, after changing its src attribute, which has not charset declaration in its script tag and encoding info in corresponding http response, can not be correctly decoded.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Mar 9 12:36:16 PDT 2008


http://bugs.webkit.org/show_bug.cgi?id=17732





------- Comment #4 from johnnyding.webkit at gmail.com  2008-03-09 12:36 PDT -------
Download both html file and script file to your local file system. The expected
behavior is content after "value which is encoded by gb2312 in html file is: "
and "same value which is encoded by gb2312 in extern javascript file is: "
should have same display, but they are not.

Please see above attached testcase. After digging in WebKit, I found the error
encoding content was generated by an external JavaScript after changing its src
attribute, which had not charset declaration in its script tag and encoding
info in http response when downloading it. So CachedScript will use "latin1" as
encoding charset. See methods CachedScript::CachedScript and
Loader::didReceiveResponse. That is why content of the external Javascript had
been incorrectly decoded.

I think we can fix this problem by using
document()->frame()->loader()->encoding() to create CacheScript obj when the
external Javascript has not charset declaration in its script
tag(getAttribute(charsetAttr) return null string). See method
HTMLScriptElement::parseMappedAttribute. This behavior makes sense just like
getting correct scriptSrcCharset in HTMLTokenizer::parseTag.  I have changed
code in my local build, it works.

A patch is coming soon.


-- 
Configure bugmail: http://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list