bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

localcharset: a comment


From: Bruno Haible
Subject: localcharset: a comment
Date: Sat, 12 Dec 2009 14:48:21 +0100
User-agent: KMail/1.9.9

I'm adding a comment, regarding the encoding of console output on Windows.


2009-12-12  Bruno Haible  <address@hidden>

        * lib/localcharset.c (locale_charset): Add comment about use of GetACP.

*** lib/localcharset.c.orig     2009-12-12 14:45:16.000000000 +0100
--- lib/localcharset.c  2009-12-12 14:44:39.000000000 +0100
***************
*** 449,455 ****
  
    static char buf[2 + 10 + 1];
  
!   /* Woe32 has a function returning the locale's codepage as a number.  */
    sprintf (buf, "CP%u", GetACP ());
    codeset = buf;
  
--- 449,467 ----
  
    static char buf[2 + 10 + 1];
  
!   /* Woe32 has a function returning the locale's codepage as a number.
!      When the output goes to a console window, in Windows 95, it would have
!      been appropriate to use GetOEMCP() instead of GetACP().  But this has
!      been corrected: In Windows XP SP3, consoles accept output in the
!      GetACP() encoding.  The GetConsoleOutputCP() function still returns
!      the same as GetOEMCP() (not GetACP()!), but the font handling in the
!      console actually uses the GetACP() encoding.  If you want to "correct"
!      this by calling SetConsoleOutputCP(GetACP()), then for a TrueType font
!      it has no visible effect on the displayed glyphs, whereas when a raster
!      font is in use, the console performs an extra conversion from GetOEMCP()
!      to GetACP() encoding, thus changing the effective codepage of the
!      console from GetACP() to GetOEMCP()!  In summary, GetConsoleOutputCP()
!      and SetConsoleOutputCP() are now completely broken.  */
    sprintf (buf, "CP%u", GetACP ());
    codeset = buf;
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]