Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The command prompt doesn’t have support of bidi languages. Therefore the components that run from the command line need not support Bidi languages. This is a limitation of Windows, which doesn’t support Bidi code pages in the console. So what should we do? Basically we have to fallback to another locale that is supported in the console. Basically we need to use GetConsoleFallbackUICulture and set this culture for our console application.
The code:
using System.Globalization;
static void Main(string[] args)
{
// Set the Current
System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("ar-EG");
// Show the Culture Info
Console.WriteLine("Culture native name: {0}", CultureInfo.CurrentUICulture.NativeName);
Console.WriteLine("Console fallback UI: {0}", CultureInfo.CurrentUICulture.GetConsoleFallbackUICulture().Name);
// Change the UI Culture to the Console Fallback UI
System.Threading.Thread.CurrentThread.CurrentUICulture =
CultureInfo.CurrentUICulture.GetConsoleFallbackUICulture();
Console.WriteLine("New UI Culture: {0}", CultureInfo.CurrentUICulture.NativeName);
}
The expected output:
Culture native name: ??????? (???)
Console fallback UI: en
New UI Culture: English
The important line is to set the UI Culture properly at the beginning to load the correct resources:
System.Threading.Thread.CurrentThread.CurrentUICulture = CultureInfo.CurrentUICulture.GetConsoleFallbackUICulture();
Anonymous
January 31, 2010
What benefit I gained after using "GetConsoleFallbackUICulture()" if I still unable to display Arabic characters?
Best regards
Anonymous
January 31, 2010
The comment has been removed
Anonymous
February 01, 2010
Unfortunately, characters still unreadable, although in both cases I can copy these unreadable characters and they are pasted correctly.
Best regards..
Anonymous
February 15, 2010
My thoughts on the problem (i.e. The real problem(s) with all of these console "fallback" discussions):
http://blogs.msdn.com/9963784.aspx
Anonymous
December 03, 2011
The comment has been removed
Anonymous
January 14, 2012
Hi Hossam,
I don't have an official statement, as this was before my time at MS... but my personal thought is that if we carry old featurescode for each release of Windows, we won't have space for new and advanced features.
There maybe third party solutions.
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in