Re: Convert UTF-8 -> ANSI not via UTF-16?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



David: you're right... but is ANSI ambiguous, isn't it?
Which ANSI? ANSI/ISO 8859-1? Or other code-pages?

Nope, in the Windows world it is not ambigous at all. It is a misnomer, all
right, but not ambigous.

ANSI = the default system code page.
This means 1252 on English systems, 932 on Japanese ones, and so on.
It is the code page returned by GetACP, or
GetLocaleInfo(LOCALE_IDEFAULTANSICODEPAGE, ...)
Can be changed by changing the default system locale ("Language for non-
Unicode programs") and rebooting

And there is no Windows locale with ISO 8859-1 as ANSI cp (the closest one is
1252, which is a superset of 8859-1). (see the mapping tables at
ftp.unicode.org for the exact differences)

See http://www.mihai-nita.net/glossary.shtml
Or http://blogs.msdn.com/michkap/archive/2005/02/08/369197.aspx
(or search for ANSI and OEM on Michael Kaplan's blog)


I remember some MS-DOS programs that did graphics in text mode; they
used some "ANSI" characters with MSB = 1 to do text-mode graphics.
Nope, DOS used the OEM code page (same as the current Windows console
applications).



--
Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email
.



Relevant Pages

  • Re: DOS Box Keyboard problem
    ... The KEYB command examined all prepared code pages, and has found that at least one code page is incompatible for your screen console device. ... The OEMCP value controls to which OEM code page to translate ANSI, ... The default OEM code page in Windows NT is the DOS 437 code page. ...
    (microsoft.public.windowsxp.configuration_manage)
  • Re: cant open command prompt (cmd.exe)
    ... modify security settings and user rights assignments ... The OEMCP value controls to which OEM code page to translate ANSI, ... You may be unable to open any console-based applications on a Windows Server ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: cant open command prompt (cmd.exe)
    ... Type: chcp hit Enter. ... The OEMCP value controls to which OEM code page to translate ANSI, ... You may be unable to open any console-based applications on a Windows Server ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Why is there no platform independent way of clearing a terminal?
    ... There is a Windows program called 'ansicon', ... intercept and interpret ANSI escape codes for colors, cursor movement, ... Since ANSI codes are used everywhere except Windows, ... codes and convert them into Win32 terminal control calls. ...
    (comp.lang.python)
  • Re: cross-platform coloured text in terminal
    ... simply embed ANSI codes in the stream to be printed. ... To make it work on Windows, printing could ...
    (comp.lang.python)