ASP.NET阿拉伯文字 - 周期错误出现在句子开头 [英] ASP.NET Arabic text - Period incorrectly appearing at beginning of sentence

查看:104
本文介绍了ASP.NET阿拉伯文字 - 周期错误出现在句子开头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含的textarea 元素设置为<$ C $ DIR 字段中的ASP.NET V4形式C>汽车:

 &LT;形式=服务器&GT;
    &LT; textarea的ID =MYTEXTNAME =MYTEXTDIR =自动的风格=宽度:400像素,高度:300像素;保证金:10px的;&GT;&LT; / textarea的&GT;
    &LT;输入类型=提交值=提交&GT;
&LT; /表及GT;

已经设置我的Windows操作系统为阿拉伯语的语言,在进入阿拉伯文字到文本框时,文本的方向是从右到左的预期。还提交表单并在code-后面检查的Request.Form [MYTEXT] 时,文本显示正确的除了一个事实,即句点字符在最后的句末(即在最左边)已经转移到了第一句开始时(即在最右边)。

例如(不使用真正的阿拉伯语词汇,因为我不知道的语言):结果
前.بثبصبصببص.بثبثبثبصيص.ثاثقاثلثبص结果
بثبصبصببص.بثبثبثبصيص.ثاثقاثلثبص后。

任何想法,为什么这种情况正在发生什么,我可以做prevent呢?


解决方案

如果我正确地理解你的问题,你担心有与秩序不正确,你应该知道,当你在RTL文本框中输入文本,并看到正确的文字,文字是正确的顺序

在调试器,你只看到首先是因为在调试器,文本框从左向右。这足以将收到的文本,然后显示时,显示有从右到左样式文本框中的文本。

要输入سلامعلیکم。正确,才能进入,第一个س然后ل 然后ا,...,最后

<大骨节病>س
<大骨节病>ل
<大骨节病>ا
<大骨节病>م
<大骨节病>空间
<大骨节病>ع
<大骨节病>ل
<大骨节病>ی
<大骨节病>ک
<大骨节病>م
<大骨节病>。

和它会正确地在一个文本框与 DIR =RTL DIR =自动作为显示你下面的示例中所看到的:

\r
\r

&LT; HTML和GT;\r
&LT; HEAD&GT;&LT;标题&GT;自动RTL-LTR&LT; /标题&GT;&LT; /头&GT;\r
&LT;身体GT;\r
  &LT;输入类型=文本DIR =自动值=。سلامعلیکم/&GT;\r
  &LT;输入类型=文本DIR =RTL值=。سلامعلیکم/&GT;\r
  &LT;输入类型=文本DIR =升值=。سلامعلیکم/&GT;\r
&LT; /身体GT;\r
&LT; / HTML&GT;

\r

\r
\r

另外,作为一个测试,你可以粘贴سلامعلیکم。在记事本或文本框,并使用左(<大骨节病>控制 + <大骨节病>移),右(<大骨节病>控制 + <大骨节病>移)LTR和RTL和看到结果之间切换。

I have an ASP.NET v4 form containing a textarea element with dir field set to auto:

<form runat="server">
    <textarea id="mytext" name="mytext" dir="auto" style="width: 400px; height: 300px; margin: 10px;"></textarea>
    <input type="submit" value="Submit"> 
</form>

Having set the language of my Windows OS to Arabic, when entering Arabic text into the text box, the direction of the text is right-to-left as expected. Also when submitting the form and inspecting the Request.Form["mytext"] in the code-behind, the text appears correct apart from the fact that the period character at the end of the final sentence (i.e. on the far left) has moved to the beginning of the first sentence (i.e. on the far right).

E.g (not using real Arabic words as I don't know the language):
before .بثبصبصببص.بثبثبثبصيص.ثاثقاثلثبص
after بثبصبصببص.بثبثبثبصيص.ثاثقاثلثبص.

Any idea why this is happening and what I can do to prevent it?

解决方案

If I understand your question correctly and you worry about having text with incorrect order, you should know when you entered text in an rtl text box and see it correctly, the text is in correct order

In debugger, you only see . at first because in the debugger, text boxes are left to right. It's enough to save received text and then when displaying, display the text in a text box having right to left style.

To enter سلام علیکم. correctly, enter in order, first س then ل then ا, ... and at last . :

س ل ا م Space ع ل ی ک م .

And it would display correctly in a textbox with dir="rtl" or dir="auto" as you see in the below sample:

<html>
<head><title>auto-rtl-ltr</title></head>
<body>
  <input type="text" dir="auto" value="سلام علیکم."/>
  <input type="text" dir="rtl" value="سلام علیکم."/>
  <input type="text" dir="ltr" value="سلام علیکم."/>
</body>
</html>

Also as a test you can paste سلام علیکم. in notepad or a textbox and using left (Ctrl+Shift) and right(Ctrl+Shift) switch between ltr and rtl and see the result.

这篇关于ASP.NET阿拉伯文字 - 周期错误出现在句子开头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆