I am currently using Arabic language to display message on Internet Explorer. Web browser is reversing Arabic character automatically I believe which is correct behavior but I don’t want browser should automatically reverse my Arabic characters. Do you have any idea which setting will help me to disable automatic reversing by browser?
For example:
HTML page source code:
<html lang="ar" dir="ltr">
<body>
<p>
آ
</p>
<p>
ح
</p>
<div>
آح
</div>
</body>
</html>
Actual output:
آ
ح
آح
Expected output:
آ
ح
ح آ
This is indeed the correct behaviour - in a predominantly left-to-right context runs of Arabic characters should be rendered right-to-left, with the whole run then placed at the appropriate point in the main left-to-right flow. But there are additional non-printing control characters you can insert into the text to override the default bidirectional rendering behaviour.
Placing the "left to right override" character (‭
) before the Arabic text will force the renderer to display the characters from left to right instead of right to left. You should also add a ‬
("pop directional formatting") after the run to restore the normal rendering behaviour for following text.
‭آح‬
renders as
آح
You get the same result by inserting the Arabic characters in reverse order:
حآ
renders as
حآ
(I don't speak Arabic so I don't know which of these two orderings is the correct logical order - the way the Unicode rendering algorithms work you're supposed to provide characters in the stream in their logical order regardless of the reading direction of a particular language)