UTF-8 encoding in WebView and ICS

To correctly display UTF-8 text in a WebView , I usually use the doctype and meta :

 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 

and I use the tooltip that I saw when the stack overflowed:

 string = URLEncoder.encode(string, "UTF-8").replaceAll("\\+", " "); 

This works fine on Gingerbread and earlier versions of Android, but my Nexus S recently got an Ice Cream Sandwich update, and French characters like Γ© , Γ  , Γ¨ etc. are displayed like this: é , for example.

I don’t know if ISO-xxxx-1 encoding is the solution, but if someone had the same problem, share it.

img

+6
source share
1 answer

Try using the loadDataWithBaseURL method with a random string for other parameters instead of loadData p>

+13
source

Source: https://habr.com/ru/post/904138/


All Articles