Problem in providing Hebrew text in UIWebview

I have Hebrew text stored in a database. When I extract and display it in UIWebview after applying some css (setting the background color and margin for the page), the text is fine, but the problem is that if I align the content in the web view correctly, then the Hebrew content will be right-aligned. but in reality it’s not as it should be. I want to say what the RTL text should look like. A full stop is displayed on the right side of the text , as shown in the figure below. I know that proper text alignment will not show how RTL text should be

Its not a duplicate , and I went through the steps mentioned, but still I don’t go.

enter image description here

I hope someone can help me show the text correctly. If necessary, I can add a CSS fragment. Please comment if any supporting code or image is required.

+3
source share
2 answers

You must either set direction: rtlin CSS or add an attribute dir="rtl"in HTML.

You may also need a script with a unicode-bidiCSS attribute if you paste this text into a mixed language paragraph.

+6
source

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];
0
source

All Articles