首页 / C# / C#-WPF阿拉伯文字无法正确显示
C#-WPF阿拉伯文字无法正确显示
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了C#-WPF阿拉伯文字无法正确显示,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2011字,纯文字阅读大概需要3分钟。
内容图文
![C#-WPF阿拉伯文字无法正确显示](/upload/InfoBanner/zyjiaocheng/688/e3db91ec1f204ca6862ed886025f569d.jpg)
我想从右到左显示一些阿拉伯文字.因此,我将流向设置为RightToLeft.下面是我的程序:
<Grid x:Name="LayoutRoot" HorizontalAlignment="Left" VerticalAlignment="Top" >
<TextBlock Margin="104,96,0,0" VerticalAlignment="Top" Height="Auto" Text="(??? ??????? ???????? 1 (?????? 12 ????" HorizontalAlignment="Left" FontSize="20" />
</Grid>
输出似乎不正确.右括号出现在不同的位置.输出为??????????????????1(??????12????)
请提供建议/解决方案.
解决方法:
问题是,虽然您的代码在XAML中“看起来”正确,但是第一个字符是“(”,这不是您想要的.您打算将此字符作为从右到左字符串的最后一个字符,这意味着它应该确实是一个’)’字符(但从右到左的语言是其镜像).
如果希望XAML正确显示,而WPF正确显示,则需要更正花括号,并使用特殊的Unicode字符& ux200F;.标记字符,以便XAML理解最后一个’)’还是从右到左.
In the algorithm, each sequence of
concatenated strong characters is
called a “run”. A weak character that
is located between two strong
characters with the same orientation
will inherit their orientation. A weak
character that is located between two
strong characters with a different
writing direction, will inherit the
main context’s writing direction (in
an LTR document the character will
become LTR, in an RTL document, it
will become RTL). If a “weak”
character is followed by another
“weak” character, the algorithm will
look at the first neighbouring
“strong” character. Sometimes this
leads to unintentional display errors.
These errors are corrected or
prevented with “pseudo-strong”
characters. Such Unicode control
characters are called marks. The mark
(U+200E ?? left-to-right mark (HTML:
? ? LRM) or U+200F ??
right-to-left mark (HTML: ?
? RLM)) is to be inserted into a
location to make an enclosed weak
character inherit its writing
direction.
尝试
<Grid x:Name="LayoutRoot" HorizontalAlignment="Left" VerticalAlignment="Top" >
<TextBlock Margin="104,96,0,0" VerticalAlignment="Top" Height="Auto" Text="??? ??????? ???????? 1 (?????? 12 ????)?" HorizontalAlignment="Left" FontSize="20" />
</Grid>
请注意,尽管外观相同,但实际上隐藏字符和结尾括号是不同的.
内容总结
以上是互联网集市为您收集整理的C#-WPF阿拉伯文字无法正确显示全部内容,希望文章能够帮你解决C#-WPF阿拉伯文字无法正确显示所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。