Reputation: 2886
I am developing a simple application in which I have to display some German text; it's working fine in Android 2.3 to Android 4.0, but when I am testing on Android 4.1 (Jelly Bean) it's not working anymore.
I have one WebView, I set data through loadData
method. See the code below:
WebView mWebView = (WebView)findViewById(R.id.MyWebView);
String chararc = "Ä Ö Ü ä ö ü";
mWebView.getSettings().setDefaultTextEncodingName("UTF-8");
mWebView.loadData(chararc, "text/html", "UTF-8");
Here I attached screenshots of Android 2.3.1 and Android 4.1:
Upvotes: 2
Views: 580
Reputation: 5737
Hi, I got it.Here's the solution, I'm sure it will work.
WebView mWebView = (WebView)findViewById(R.id.MyWebView);
String chararc = "Ä Ö Ü ä ö ü";
mWebView.getSettings().setDefaultTextEncodingName("UTF-8");
mWebView.loadData(chararc, "text/html; charset=UTF-8",null);
Upvotes: 1