Displaying non UTF-8 8 bit character codes with writefln()

Stewart Gordon smjg_1998 at yahoo.com
Fri Oct 5 08:03:26 PDT 2007


"Regan Heath" <regan at netmail.co.nz> wrote in message 
news:fe5g9k$5i6$1 at digitalmars.com...
<snip>
> True.  I wonder what the vista console defaults to?  Are they still using 
> local code pages or are they using UTF-8 or UTF-16 (perhaps more likely)
<snip>

Mine defaults to 850.  (Strange - British installations of MS-DOS back in 
the day always default to 437 as far as my experience goes.  Sometimes under 
Win9x, you would get the anomaly of 437 in full screen mode, but a console 
font in windowed mode that's set up for 850.)  But having it use UTF-16 
would break far too many programs.  There is, however, a function 
ReadConsoleW, which reads characters in UTF-16 regardless of the active code 
page.  But it doesn't work if stdin is redirected.

But I also found that ReadFile doesn't handle UTF-8 console input properly. 
Look at the way my library uses the two functions, each to get around the 
problems with the other depending on circumstance.

Stewart.

-- 
My e-mail address is valid but not my primary mailbox.  Please keep replies 
on the 'group where everybody may benefit. 



More information about the Digitalmars-d-learn mailing list