French in Webview

Common bugs/problems with the Android SDK the Emulator and the ADT-Plugin.

French in Webview

Postby araja » Mon Nov 09, 2009 8:31 am

I am using Android 2.0 and I have changed the device locale to french(France).
The Webview is unable to show french characters in a web page. The same web page displays french characters properly in Android web browser.
How can I enable french in webview?
araja
Developer
Developer
 
Posts: 27
Joined: Wed Nov 04, 2009 9:03 am

Top

Re: French in Webview

Postby nioupy » Thu May 20, 2010 9:39 pm

Hi Araja,

Did you find a solution to your problem ? I am currently trying to display Cyrillic but can't do it... The same data in a textview displays fine though...
nioupy
Developer
Developer
 
Posts: 36
Joined: Sat Apr 03, 2010 1:34 pm

Re: French in Webview

Postby araja » Fri May 21, 2010 6:22 am

No, I couldn't find any solution. Let me know if you find any.
araja
Developer
Developer
 
Posts: 27
Joined: Wed Nov 04, 2009 9:03 am

Re: French in Webview

Postby nioupy » Sun May 23, 2010 10:16 pm

Got my solution here :
http://code.google.com/p/android/issues/detail?id=3552

webview.loadData(URLEncoder.encode("<html><body>漢字 テスト</body></html>",
"utf-8").replaceAll("\\+"," "), "text/html", "utf-8");


hope this helps you as much as it helped me :)
nioupy
Developer
Developer
 
Posts: 36
Joined: Sat Apr 03, 2010 1:34 pm

Re: French in Webview

Postby nioupy » Mon May 24, 2010 11:06 am

Hmm, I was shouting "victory" too fast : this works perfectly on my emulator with Android 1.5 but still displays garbage with both my emulator and physical device under 2.1 ...
So I used the last solution given on the page linked in my previous post : that works on 2.1, but guess what happened with my 1.5 ? not working anymore...

solving that will be a bit of a challenge for me...
nioupy
Developer
Developer
 
Posts: 36
Joined: Sat Apr 03, 2010 1:34 pm

Re: French in Webview

Postby nioupy » Mon May 24, 2010 11:29 am

or not so complicated : since both :
Code: Select all
webview.loadData(URLEncoder.encode("<html><body>漢字 テスト</body></html>",
"utf-8").replaceAll("\\+"," "), "text/html", "utf-8");


and
Code: Select all
wv.loadData("<html><meta http-equiv=\"Content-Type\" content=\"text/html;
charset=utf-16le\"><body>漢字テスト</body></html>", "text/html", "utf-8");


work for a version of the OS, I put both in one line that works the same for both OS :
Code: Select all
vw.loadData(URLEncoder.encode("<html><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"><body>" + TextToDisplay + "</body></html>","utf-8").replaceAll("\\+"," "), "text/html", "utf-8");
nioupy
Developer
Developer
 
Posts: 36
Joined: Sat Apr 03, 2010 1:34 pm

Top

Return to SDK/ADT/Emulator Problems

Who is online

Users browsing this forum: No registered users and 1 guest