duonglaiquang · GitHub

added 12 commits

March 16, 2024 10:36
This commit fixes an issue where WebResponse.getCharset() fails to
correctly sniff certain charsets in content-type meta tag due to
missing support for charset aliases in EncodingSniffer.toCharset().
This commit fixes the priority of the BOM charset and moves it to the
highest level to be in line with html/js/css etc. specs.
This commit deprecates WebResponse.defaultCharsetUtf8() and adds a
more flexible WebRequest.setDefaultResponseContentCharset() that will
be used in the proceeding refactorization commits.
This commit changes the default charset of JavaScript to utf-8 to be in line
with official specs.
This commit changes the default charset of CSS to utf-8 to be in line
with official specs.
This commit changes the prescan length of HTML from 4096 bytes to 1024
to behave similarly to modern browsers.
This commit changes iframes to be more in line with specs by changing
it to use the container document's charset as the fallback charset
when a charset is not specified by the iframe document.
This commit moves the BOM and content-type header charset reading code
to inside WebResponse.getContentCharsetOrNull() rather than
EncodingSniffer since it is common code, and for better flexibility in
the proceeding feature commits.
This commit remove the hard to understand getContentCharsetOrNull() and
instead adds wasContentCharsetTentative() used to check if the charset
returned by getContentCharset() was tenatative.
This commit also adds getHeaderContentCharset() as a utility method.

@rbri

Read the original on github.com ↗