views:

29

answers:

2

I have Unicode text being displayed on an ASP.NET page. The text is enclosed by two square brackets, as soon as Arabic text appears the ending bracket goes reverse, e.g. "[Hi there]" becomes "[ [arabic". Is this a browser issue? The brackets are hard-coded and only the enclosing text is dynamic.

Here is some sample code. The variable resultString contains the Unicode text.

<%
Response.Write("[" + resultString+ "]  ");
%>
+1  A: 

Editing to not be stupid. This should do what you want.

<%
    string resultString = "العربية";
    Response.Write("<p dir = \"LTR\"> [" + resultString + "]</p>  ");
%>
Brian
Dude, you're the man!
Wajih
A: 

Is the string properly padded with RTL/LTR marks? (Unicodes U+200E and U+200F unless I'm mistaken). That is usually required to make bidirectional text behave as expected in normal applications, though I'm not sure how it applies to a web page.

Christoffer