3

I have some hebrew text stored in database. When I fetch & render it in UIWebview after applying some css (setting the background color and margin for the page) the text comes up fine but the problem is that If I right align the content in webview then the Hebrew content gets right aligned but actually it is not the way it is supposed to be. I mean the way RTL text should have shown. The Full stop appears on the right hand side of the text as shown in image below. I know that right aligning the text will not show it the way RTL text should be

Its not a duplicate and I have gone through the steps mentioned there but still no go.

enter image description here

I hope if someone can help me to shown the text in correct way . I can add the CSS snippet if required. Please comment if any supporting code or image is required

Community
  • 1
  • 1
Rahul Sharma
  • 3,013
  • 1
  • 20
  • 47
  • This actually has **nothing at all** to do with the other question you linked to. It relates only to how Hebrew should be rendered in HTML. – Ken Bloom Jun 20 '11 at 00:31
  • My suspicion is that it's right-aligned left-to-right text, so it treats the Hebrew characters the same as it would "Abc def." – tc. Jun 20 '11 at 01:28

2 Answers2

7

You should either set direction: rtl in the CSS or add a dir="rtl" attribute in the HTML.

You may also need to fiddle with the unicode-bidi CSS attribute as well if you're embedding this text into a mixed-language paragraph.

Ken Bloom
  • 57,498
  • 14
  • 111
  • 168
0

u need to specify dir="rtl" in html then you will get the data from right to left

Example:

    NSString  *htmlStringwithFont = [NSString stringWithFormat:@"<span style=\"font-family: %@; color:#343434;font-size: %i\" **dir=\"rtl\"**>%@</span>",
                                      font.fontName,
                                      (int) font.pointSize,
                                      content];
           webView.opaque=NO;
            [webView loadHTMLString:htmlStringwithFont baseURL:nil];
Rahul Sharma
  • 3,013
  • 1
  • 20
  • 47