views:

43

answers:

4

Hi ,

I'm Loading an Hebrew (rtl) xml feed with xml Dom using eclipse android environment.

When displaying the feed on TextView text is OK but numbers Displaying inverse

for example :

if feed (XML) contain 007 it WILL displayed as 700..

any help blessed (:

thanks

A: 

Android doesn't officially support RTL languages.

Have a look here: http://stackoverflow.com/questions/2584245/android-rtl-support-digits-embedded-in-a-right-to-left-sentence-hebrew

Daphna Shezaf
Thanks both for your replying, I will check the webkit control..
Zohar Adar
+1  A: 

I'm re-posting my own answer:

"Try presenting your text in a webkit control, its RTL support works fine, as long as the HTML code is tagged appropriately."

Hope that helps you too.

VitalyB
Hi VitalyB,I tried use the webview if that what you meant when you said "webkit control"I changed the textview to webview and set the html encodingString stext= "<html><body>שלום <b>007</b> points.</body></html>";I tried thiswebview.loadData(stext, "text/html", "utf-8");and this webview.loadData(stext, "text/html", "windows-1255");but still didn't solve it and getting a gibberish text now ..any helped will blessed..thanks
Zohar Adar
Hey Zohar, I never actually did it myself but a friend said it worked great for him. I'll try to ask his help for your issue.
VitalyB
A: 

I don't have enough rep to reply to the comments on @Vitalyb's answer, but I have used this solution and it works great. You just need to use a webview, and load it with html text. There are plenty of code samples available on the Android dev sites.

eli
Zohar Adar
OK ,Thanks that solve it (: just need to add:"<body style=\"text-align:right;direction:rtl;\"> "+ mytext + ""</body>
Zohar Adar
A: 

my final solution was:

add a charset=utf-8

public static String BuildHtml(String _HtmlString)
{       
    StringBuilder sb = new StringBuilder();
    sb.append("<html>");
    sb.append("<meta http-equiv=\"Content-Type\" content=\"text/html;
            charset=utf-8\">");
    sb.append("<body style=\"direction:rtl;\">");
    sb.append(_HtmlString.trim());
    sb.append("</body>");
    sb.append("</html>");

    return sb.toString();
}

then calling it just before loadData..

 myWebview.loadData(BuildHtml(mytext), "text/html", "utf-8");

I will glad to hear about (light) simple solution then that,for using a TextView instead of WebView..

thanks

http://www.wave-site.com/

Zohar Adar