Class HtmlCharset
java.lang.Object
com.vaadin.swingbridge.surrogates.internal.HtmlCharset
Works out which charset a fetched HTML page is encoded in.
Order of evidence, matching what browsers do and what
JEditorPane.setPage is expected to honour: the charset
parameter of the Content-Type response header, then a <meta>
declaration in the markup, then UTF-8.
The header parameter is deliberately not read from
URLConnection.getContentEncoding() — that returns the
Content-Encoding header, which carries the compression
(gzip, deflate) and is unrelated to the charset. It is null on
an ordinary response even when Content-Type declares a charset, so
using it means silently decoding every non-UTF-8 page as UTF-8.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringcharsetParam(String contentTypeHeader) Thecharsetparameter of a Content-Type header, ornull.static Charsetstatic booleanisHtmlMediaType(String contentTypeHeader) Whether the header's media type is HTML.
-
Method Details
-
detect
-
charsetParam
-
isHtmlMediaType
Whether the header's media type is HTML. Used to WARN when a page is served as something else, since the pane renders it as HTML regardless.
-