{"id":33593,"date":"2005-10-27T09:59:37","date_gmt":"2005-10-27T09:59:37","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2005\/10\/27\/why-is-the-oem-code-page-often-called-ansi\/"},"modified":"2022-10-24T10:20:19","modified_gmt":"2022-10-24T17:20:19","slug":"why-is-the-oem-code-page-often-called-ansi","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20051027-37\/?p=33593","title":{"rendered":"Why is the OEM code page often called ANSI?"},"content":{"rendered":"<p><a title=\"Consoling people about their troubles with the console.\" href=\"http:\/\/web.archive.org\/web\/20070430132706\/http:\/\/blogs.msdn.com\/michkap\/archive\/2005\/06\/29\/433669.aspx\"> It has been pointed out<\/a> that the documentation for the cmd.exe program says<\/p>\n<blockquote class=\"q\"><p>\/A Causes the output of internal commands to a pipe or file to be ANSI<\/p><\/blockquote>\n<p>even though the output is actually in the OEM code page. Why do errors such as this persist?<\/p>\n<p>Because ANSI sometimes means OEM.<\/p>\n<p>The &#8220;A&#8221; versions of the console functions accept characters in the OEM code page despite the &#8220;A&#8221; suffix that would suggest ANSI. What&#8217;s more, if you call the <!-- HREF=\"http:\/\/msdn.microsoft.com\/library\/en-us\/fileio\/fs\/setfileapistooem.asp\" --> <code>SetFileAPIsToOEM<\/code> function, then &#8220;A&#8221; functions that accept file names will also interpret the filenames in the OEM code page rather than the ANSI code page.<\/p>\n<p>&#8220;There are two types of people in the world: Those who believe that the world can be divided into two types of people, and those who do not.&#8221;<\/p>\n<p>There are those who mentally divide the world of characters into two groups: Unicode and 8-bit. And as you can see, many of them were involved in the original design of Win32. There are &#8220;W&#8221; functions (Unicode) and &#8220;A&#8221; functions (ANSI). There are no &#8220;O&#8221; functions (OEM). Instead, the OEM folks got lumped in with the ANSI folks.<\/p>\n<p>There are also those who realize the distinction, but out of laziness or convenience often use &#8220;ANSI&#8221; as an abbreviation for &#8220;an appropriate 8-bit character set, determined from context&#8221;. In the context of console programming, the appropriate 8-bit character set is the OEM character set.<\/p>\n<p>The person who wrote the online help for cmd.exe clearly meant ANSI to mean &#8220;That thing that isn&#8217;t Unicode.&#8221;<\/p>\n<blockquote class=\"q\"><p>\/A Causes the output of internal commands to a pipe or file to be ANSI<br \/>\n\/U Causes the output of internal commands to a pipe or file to be Unicode<\/p><\/blockquote>\n<p>I&#8217;ll leave you to decide whether this author belongs to the &#8220;Everything is either Unicode or ANSI&#8221; camp or the &#8220;just being casual&#8221; camp.<\/p>\n<p>Related: <a href=\"https:\/\/devblogs.microsoft.com\/oldnewthing\/20050308-00\/?p=36253\"> Keep your eye on the code page<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>More laziness.<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[2],"class_list":["post-33593","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-history"],"acf":[],"blog_post_summary":"<p>More laziness.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/33593","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=33593"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/33593\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=33593"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=33593"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=33593"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}