Android WebView UTF-8 not showing
Use:
mWebView.loadDataWithBaseURL(null, "將賦予他們的傳教工作標示為", "text/html", "utf-8", null);
or using WebSettings with setDefaultTextEncoding:
WebSettings settings = mWebView.getSettings();
settings.setDefaultTextEncodingName("utf-8");
For recent versions of Android, API 16 to 22 it was tested and work properly using loadData() method, requires the mimeType to include: "charset=utf-8".
WebView mWebView = (WebView) findViewById(R.id.myWebView);
WebSettings settings = mWebView.getSettings();
settings.setDefaultTextEncodingName("utf-8");
mWebView.loadData(myCharacters, "text/html; charset=utf-8",null);
or
mWebView.loadData(myCharacters, "text/html; charset=utf-8","UTF-8");
Android WebView with garbled UTF-8 characters.
You can try to edit the settings of your webview before you load the data:
WebSettings settings = mWebView.getSettings();
settings.setDefaultTextEncodingName("utf-8");
Also, as provided in the comment below, be sure to add "charset=utf-8"
to the loadData call:
mWebView.loadData(getString(R.string.info_texto), "text/html; charset=utf-8", "utf-8");
Related Topics
Firebase Console: How to Specify Click_Action for Notifications
How to Hide "Navigation" and "Gps Pointer" Buttons When I Click The Marker on The Android Google Map
How to Take Pictures from The Camera Without Preview When My App Starts
How to Debug on a Real Device (Using Eclipse/Adt)
Inconsistency Detected in Recyclerview, How to Change Contents of Recyclerview While Scrolling
Does Android Service Run from a Separated Thread Instead of UI
Service Intent Must Be Explicit: Intent
How to Access an Existing Sqlite Database in Android
How to Prevent The Activity from Loading Twice on Pressing The Button
Android, How to Exec a SQL File in Sqlitedatabase
How to Remove White Underline in a Searchview Widget in Toolbar Android
Setting Action Bar Title and Subtitle
Crop Square Image to Circle - Programmatically
Combining Two Bitmap Image (Side by Side)
Android: How to Download a Video File to Sd Card