更新时间:2023-11-13 13:40:40
有几个问题需要解决,以得到这个工作。
请参阅KB:的字体是在命令窗口中提供必要的标准>
字体必须是一个固定间距字体。
字体不能为斜体。
该字体不能有负A或C空间。
如果是TrueType字体,它必须是FF_MODERN。
如果它不是一个TrueType字体,它必须是OEM_CHARSET。
块引用>
- 您必须安装的字体。
有关测试,我用幻觉记忆单,这是支持阿拉伯为数不多。阿拉伯语是一个艰难的语言作出单型字体与由于语言的美观不与固定的宽度为每个字符很好地工作。然而,这种字体使一个诚实的努力。对于其他可能的替代方案,请参阅:
字体必须安装在正常的方式为您的Windows版本(Vista中/ 7/8,这是
单击鼠标右键,在.TTF文件安装
) 。一旦做到这一点,你必须遵循的KB方向。
- 注册表编辑器 - > HKLM \\软件\\微软\\ WindowsNT的\\ CURRENTVERSION \\控制台\\ TrueTypeFont
- 添加一个名为新字符串值
000
与值幻觉记忆国界单
- 重新启动
一旦你重新启动,你可以从控制台菜单中选择属性,在字体选项卡更改字体更改控制台的字体。
结果。
...所以这一切之后,我们发现,控制台不支持从右到左。语言我想你可以使用类似的函数:
静态字符串反转(字符串文本)
{
如果(文字== NULL)返回NULL;
的char []数组= text.ToCharArray();
Array.Reverse(数组);
返回新的字符串(数组);
}然后执行
Console.OutputEncoding = System.Text.Encoding.Uni code;
Console.WriteLine(反向(مرحبابك));
I believe it was possible to show Arabic characters on a console application 13+ years ago, since the days of Windows ME.
Now i am using Visual Studio 2013, On a Windows 8, and the following code shows:
????? ??
Console.OutputEncoding = System.Text.Encoding.Unicode; Console.WriteLine("مرحبا بك");
Is there anyway to show Arabic characters in the console output?
There are several issues to resolve to get this to work.
- You need a font that supports both Arabic AND the windows console.
See KB : Necessary criteria for fonts to be available in a command window
The font must be a fixed-pitch font. The font cannot be an italic font. The font cannot have a negative A or C space. If it is a TrueType font, it must be FF_MODERN. If it is not a TrueType font, it must be OEM_CHARSET.
- You must install the font.
For testing, I used DejaVu Mono, which is one of the few that supports Arabic. Arabic is a tough language to make a monotype font with since the aesthetics of the language do not work well with a fixed width for each character. Nevertheless, this font makes an honest effort. For other possible alternatives, see :
complete, monospaced Unicode font?
The font must be installed in the normal way for your version of Windows (in Vista/7/8 this is
right-click, Install
on the .ttf file). Once this is done, you have to follow the directions in the KB.
- Registry Editor --> HKLM\Software\Microsoft\WindowsNT\CurrentVersion\Console\TrueTypeFont
- Add a new string value named "
000
" with the valueDejaVu Sans Mono
- Reboot
Once you've rebooted, you can change the font in the console by selecting "Properties" from the console menu and changing the font in the "Font" tab.
Result.
... so after all that, we discover that the console does not support Right-To-Left languages. I guess you could use a function like :
static string Reverse(string text) { if (text == null) return null; char[] array = text.ToCharArray(); Array.Reverse(array); return new String(array); }
and then do
Console.OutputEncoding = System.Text.Encoding.Unicode; Console.WriteLine(Reverse("مرحبا بك"));