{"id":31913,"date":"2006-03-15T10:00:16","date_gmt":"2006-03-15T10:00:16","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2006\/03\/15\/on-the-fuzzy-definition-of-a-unicode-application\/"},"modified":"2006-03-15T10:00:16","modified_gmt":"2006-03-15T10:00:16","slug":"on-the-fuzzy-definition-of-a-unicode-application","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20060315-16\/?p=31913","title":{"rendered":"On the fuzzy definition of a &#034;Unicode application&#034;"},"content":{"rendered":"<p>Commenter mpz wondered <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2005\/10\/14\/481044.aspx#481387\"> why the IME cannot detect whether it is sending characters to a Unicode or non-Unicode application and generate the appropriate character accordingly<\/a>.\n But what exactly is a Unicode application? Actually, let me turn the question around: What is a non-Unicode application?\n Suppose you write a program and don&#8217;t <code>#define UNICODE<\/code>, so you&#8217;d think you have a non-Unicode application. But your program uses a control provided by another library, and the authors of that library defined <code>UNICODE<\/code>. The controls created by that library are therefore Unicode, aren&#8217;t they? Now you type that frustrating character to a control created by that library. Should it generate a U+00A5 or a U+005C?\n To know the answer to that question requires psychic powers. If the control takes the character and uses it exclusively internally, then presumably the IME should generate U+00A5. But if the control takes the character and returns it back to your program (say the control is a fancy edit control), then presumably the IME should generate U+005C. How does it know? It&#8217;s not going to do some sort of analysis of the code in the helper library to decide what it&#8217;s going to do with that character. Even human beings with access to the source code may have difficulty deciding whether the character will ever get converted to the <code>CP_ACP<\/code> code page in the future. Indeed, if the decision is based on the user&#8217;s future actions, then you will need to invoke some sort of clairvoyance (and relinquishing of free will) to get the correct answer.<\/p>\n<p> Note that this helper library might be in the form of a static library, in which case your application is really neither Unicode nor ANSI, but rather a mix of the two. Parts of it are Unicode and parts are ANSI. What&#8217;s a poor IME to do? <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Commenter mpz wondered why the IME cannot detect whether it is sending characters to a Unicode or non-Unicode application and generate the appropriate character accordingly. But what exactly is a Unicode application? Actually, let me turn the question around: What is a non-Unicode application? Suppose you write a program and don&#8217;t #define UNICODE, so you&#8217;d [&hellip;]<\/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":[26],"class_list":["post-31913","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-other"],"acf":[],"blog_post_summary":"<p>Commenter mpz wondered why the IME cannot detect whether it is sending characters to a Unicode or non-Unicode application and generate the appropriate character accordingly. But what exactly is a Unicode application? Actually, let me turn the question around: What is a non-Unicode application? Suppose you write a program and don&#8217;t #define UNICODE, so you&#8217;d [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/31913","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=31913"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/31913\/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=31913"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=31913"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=31913"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}