开发者

Brackets go backward on Unicode text

I have Unicode text being开发者_C百科 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+ "]  ");
%>


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

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜