user349026
user349026

Reputation:

Brackets go backward on Unicode text

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+ "]  ");
%>

Upvotes: 0

Views: 282

Answers (2)

Christoffer
Christoffer

Reputation: 12910

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.

Upvotes: 0

Brian
Brian

Reputation: 25834

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

<%
    string resultString = "العربية";
    Response.Write("<p dir = \"LTR\"> [" + resultString + "]</p>  ");
%>

Upvotes: 2

Related Questions