special character are not displayed properly in android webView -
When I display a and this is my You can change settings for page encoding. for example. You must make sure to set it before requesting to load the website. should be supported in utf-8, so I do not know why not work otherwise. WebView page in my Android device (4.0) I think That particular character like ÃÆ'à à ⠀ ™ a is not displayed properly, like
WebView code.
Extends the public square browser activity {WebView ourBrow; String Address; @ Override Protected Zero (InstanceStat saved from bundle) {// Todo auto-generated method stub super. Connet (Saved Instantstate); setContentView (R.layout.browser); Try {getActionBar () SetDisplayShowHomeEnabled (wrong); } Hold (Exception E) {} Try {ourBrow = (WebView) findViewById (R.id.wvBrowser); ourBrow.getSettings () setJavaScriptEnabled (true). . OurBrow.getSettings () setLoadWithOverviewMode (true); . OurBrow.getSettings () setUseWideViewPort (true); ourBrow.setWebViewClient (New Our ViewClient ()); OurBrow.setWebChromeClient (New WebChromeClient ()); OurBrow.getSettings () setSupportMultipleWindows (true). String url = null; Intent = getIntent (); Try {if (intention! = Tap) {if (intent.getExtras ()! = Null} {url = intent.getExtras (). GetString ("url"); }} If (url! = Null & amp;! Url.equals ("")) {ourBrow.loadUrl (url); }} Hold (exception e) {}} hold (exception e) {}} @ override protected pause at zero () {// TODO auto generated method STAB Super. Ultimate (); If (our owls! = Null) {ourBrow.stopLoading (); OurBrow.onPause (); // prevents background threads, blocks sound playback. Pause Timers (); // prevents WebViewCore}} @ override public boolean on cret option menu (menu menu) {// to-auto auto-generated method stub MenuInflater inflater = getMenuInflater (); Inflater.inflate (R.MenuMeGoback, menu); Back true; } @ Override Public Boolean On Option Etym Selected (Menu Item) {// Todo Auto-Generated Method Stub Switches (Ietate.Gate ITMID)} // // When the setting was selected, Case R. goback: ourBrow.stopLoading (); OurBrow.onPause (); // prevents background threads, blocks sound playback. Pause Timers (); // WebViewCore stops our rave; DestroyDrawingCache (); // Removes the scene from our RAM = null; End(); break; Default: Break; } Back true; } The public class provides ourViewClient WebViewClient {@ Override Public Boolean Should Override URL Loading (WebView View, String URL) {// TODO Auto-Generated Method Stub //view.loadUrl(url); view.loadDataWithBaseURL (empty, url, "text / html", "utf-8", tap); Back true; }}
Web settings setting = myWebView.getSettings (); settings.setDefaultTextEncodingName ("utf-8");
Comments
Post a Comment