Can't display certain chars in console programs

  • Thread starter Thread starter glean
  • Start date Start date
G

glean

My console in WinXP is using Lucida Console for the font.

My problem is, I can go to character map and select a
string of special characters such as the following: ®¾Öþ¬«§¯
I can paste them into my console by right-clicking the
title, then edit, paste, and everything is fine.

When I try to display them on the console programmatically
by using Console.WriteLine("®¾Öþ¬«§¯"); , the console
actually displays it as r_Ö_¬«§_

As you can see, some characters were replaced by
underscores, even though they are supported in the current
font's character set.

I tried writing it with unicode codes
Console.WriteLine("\u00AE\u00BE\u00D6\u00FE\u00AC\u00AB\u00A7\u00AF");
which resulted in the same incorrect output.

I also tried @"®¾Öþ¬«§¯" (using the @ symbol in front) with
no luck.

Anyone know how to fix this?
 
My guess is that the Console class converts the string
to ASCII before printing to console and
that would account for dumping/replacing the "extended"
characters.

You might have to use the console or "Character Mode"
Win32 APIs directly.

-c



My console in WinXP is using Lucida Console for the font.

My problem is, I can go to character map and select a
string of special characters such as the following: ®¾Öþ¬«§¯
I can paste them into my console by right-clicking the
title, then edit, paste, and everything is fine.

When I try to display them on the console programmatically
by using Console.WriteLine("®¾Öþ¬«§¯"); , the console
actually displays it as r_Ö_¬«§_

As you can see, some characters were replaced by
underscores, even though they are supported in the current
font's character set.

I tried writing it with unicode codes
Console.WriteLine("\u00AE\u00BE\u00D6\u00FE\u00AC\u00AB\u00A7\u00AF");
which resulted in the same incorrect output.

I also tried @"®¾Öþ¬«§¯" (using the @ symbol in front) with
no luck.

Anyone know how to fix this?
 
Actually, the problem is that the OEM code page is being used, while the
'ANSI' code page (or plain old Unicode) is what is probably wanted. 'ASCII'
never enters to it....
 
Back
Top