Question

i want to write on C# console in visual studio but it is not readable, only question mark is printed in space of each Urdu character.

Was it helpful?

Solution

Unless you use a Unicode font, console applications will use the codepage defined by the machine's System locale. You can either change your system locale to one that supports Urdu or change the console's font to a Unicode font.

The '?' characters appear when Windows tries to display characters from one codepage using a codepage that has no corresponding characters for the original ASCII codes. Weird characters may appear when the target ASCII code exists but corresponds to a different glyph.

OTHER TIPS

From Console.OutputEncoding Property on MSDN:

Note that successfully displaying Unicode characters to the console requires the following:

  • The console must use a TrueType font, such as Lucida Console or Consolas, to display characters.
  • A font used by the console must define the particular glyph or glyphs to be displayed. The console can take advantage of font linking to display glyphs from linked fonts if the base font does not contain a definition for that glyph.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top