Question

I came across both spelling, "UTF-8" and "utf-8" as an encoding value in WebView related methods' parameters, e.g.

new WebResourceResponse("text/javascript", "UTF-8", inputStream);

webView.loadData(getHtml(), "text/html", "utf-8");

Is it case insensitive?
Can't find a list of possible encodings.

Was it helpful?

Solution

The encoding parameter is actually a misleading one.

When used in the context of the loadData function, it's only used by the WebView to determine whether the data is base-64 encoded or not. So it's value is meaningless unless you are passing base-64 encoded content, when it must be "base64" (and should be lower case).

The case of the charset set in WebResourceResponse is case-insensitive.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top