Has anyone succeeded in displaying non latin-1 characters in Webview after RC33?

Showing 1-7 of 7 messages
Has anyone succeeded in displaying non latin-1 characters in Webview after RC33? Chister Nordvik 2/13/09 11:28 AM
String xml = "<html>" +
  "<body>" +
        "Norwegian chars: &aring;&oslash;" +
  "</body>" +
"</html>";
myWebView.loadData(xml, "text/html", "UTF-8");

This code works for latin-1 but as far as I know there are not HTML
entities defined for Latin-2 so I was wondering if there are other
solutions to displaying non latin-1 in a Webview? I've tried encoding
the string given to loadData as UTF-8 but with little success...

-Christer
Re: [android-developers] Has anyone succeeded in displaying non latin-1 characters in Webview after RC33? Mark Murphy 2/13/09 12:33 PM

The string provided to loadData() is loaded via a data: URL and so needs
to be URL-encoded, apparently.

--
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ Version 2.0 Published!

Re: Has anyone succeeded in displaying non latin-1 characters in Webview after RC33? kolby 2/14/09 5:55 AM
Mark,

thanks for the tip on the URI encoding of the data for loadData. It
worked like a charm. Apparently, I'm not the only one with this
problem though. API documentation would go along way.

Michael

Re: Has anyone succeeded in displaying non latin-1 characters in Webview after RC33? Fred Grott 2/14/09 7:08 AM
Kolby, Someone just updated javadocs for webview and etc in
source..its in code review..

I found a lot of more answers ot webview question i had..hold on link
is

http://review.source.android.com/Gerrit#patch,sidebyside,8267,1,core/java/android/webkit/WebView.java
Re: Has anyone succeeded in displaying non latin-1 characters in Webview after RC33? kolby 2/14/09 9:54 AM
Apparently the problem was not documentation, but my lack of
understanding of the data: scheme.
My bad,
Michael

On Feb 14, 10:08 am, "Fred Grott(shareme)" <fred.gr...@gmail.com>
wrote:
> Kolby, Someone just updated javadocs for webview and etc in
> source..its in code review..
>
> I found a lot of more answers ot webview question i had..hold on link
> is
>
> http://review.source.android.com/Gerrit#patch,sidebyside,8267,1,core/...
Re: Has anyone succeeded in displaying non latin-1 characters in Webview after RC33? Chister Nordvik 2/14/09 11:29 AM
Thanks! That did the trick :-)

Seems like they changed the behavior in RC33, but now it works
perfectly again.

-Christer
Re: Has anyone succeeded in displaying non latin-1 characters in Webview after RC33? yhfudev 2/14/09 3:48 PM
you may use:

loadDataWithBaseURL (null, content, "text/html", "utf-8",
"about:blank");


On Feb 13, 2:33 pm, Mark Murphy <mmur...@commonsware.com> wrote:
> Chister Nordvik wrote:
> > String xml = "<html>" +
> >   "<body>" +
> >         "Norwegian chars: &aring;&oslash;" +
> >   "</body>" +
> > "</html>";
> > myWebView.loadData(xml, "text/html", "UTF-8");
>
> > This code works for latin-1 but as far as I know there are not HTML
> > entities defined for Latin-2 so I was wondering if there are other
> > solutions to displaying non latin-1 in aWebview? I've tried encoding
> > the string given to loadData as UTF-8 but with little success...
>
> The string provided to loadData() is loaded via a data: URL and so needs
> to be URL-encoded, apparently.
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com