{"id":32103,"date":"2006-03-01T10:00:14","date_gmt":"2006-03-01T10:00:14","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2006\/03\/01\/keep-your-eye-on-the-code-page-practical-exam\/"},"modified":"2006-03-01T10:00:14","modified_gmt":"2006-03-01T10:00:14","slug":"keep-your-eye-on-the-code-page-practical-exam","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20060301-14\/?p=32103","title":{"rendered":"Keep your eye on the code page, practical exam"},"content":{"rendered":"<p>\nThe instructions that came with my new monitor are printed\nin several languages.\nOne of those languages is Polish, or at least it would be Polish if&#8230;\nwell, you&#8217;ll see.\n<\/p>\n<blockquote CLASS=\"q\"><p>\nUWAGA: Szczeg&#xF3;&#xB3;owe informacje dla u&#xBF;ytkownika\nznajduj&#xB9; si&#xEA; na do&#xB3;&#xB9;czonej p&#xB3;ycie CD.\n<\/p><\/blockquote>\n<p>\nThis is garbage.  What they meant to write was\n<\/p>\n<blockquote CLASS=\"q\"><p>\nUWAGA: Szczeg&#xF3;&#x142;owe informacje dla u&#x17c;ytkownika\nznajduj&#x105; si&#x119; na do&#x142;&#x105;czonej\np&#x142;ycie CD.\n<\/p><\/blockquote>\n<p>\n(It means, &#8220;Note: Detailed user information is included on the CD.&#8221;)\n<\/p>\n<p>\nWhat went wrong?\nWhy did all but one of the accented characters come out corrupted?\n<\/p>\n<p>\nThe company responsible for the instructions failed to\n<a HREF=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2005\/03\/08\/389527.aspx\">\nkeep their eye on the code page<\/a>.\nThe text provided to them by their Polish translator\nwas in\n<a HREF=\"http:\/\/www.microsoft.com\/globaldev\/reference\/sbcs\/1250.mspx\">\ncode page 1250 (Central Europe)<\/a>.\nIf you hold up that code page diagram next to\n<a HREF=\"http:\/\/www.microsoft.com\/globaldev\/reference\/sbcs\/1252.mspx\">\ncode page 1252 (Latin I)<\/a>,\nyou can see where the problem is.\nThe company took that string in code page 1250\nand printed it in code page 1252.\nFor example, the &#8220;&#x142;&#8221; character is at position B3 in code page 1252;\nthe character at that position in code page 1250 is &#8220;&#xB3;&#8221;.\n<\/p>\n<p>\nI just hope their Polish customers can figure out what the text is\nsupposed to say.\n<\/p>\n<p>\nOkay, that was their practical exam.\nHere&#8217;s yours:\n<\/p>\n<blockquote CLASS=\"m\">\n<p>\nI am running on a Spanish install of Windows&nbsp;2003 and calling\n<\/p>\n<pre>\nWideCharToMultiByte(CP_OEMCP, WC_NO_BEST_FIT_CHARS,\n                    pwzStr, -1, pszStr, nRet, NULL, pbUsedDefault);\n<\/pre>\n<p>\nWhen I pass this Unicode string\n<\/p>\n<pre>\nD:\\Documents and Settings\\ABC\\Configuraci&oacute;n local\\\n<\/pre>\n<p>\nit returns the multibyte string below and doesn&#8217;t set\n<code>pbUsedDefault<\/code>:<\/p>\n<pre>\nD:\\Documents and Settings\\ABC\\Configuraci&cent;n local\\\n<\/pre>\n<p>\nWhy isn&#8217;t <code>pbUsedDefault<\/code> set?\n<\/p>\n<\/blockquote>\n<p>\nIn fact, I&#8217;m going to add two bonus questions:\n(1)&nbsp;How should this customer change their code to get\nthe path name converted correctly?\n(2)&nbsp;Why?\nThe answer to the second question is the important one.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The instructions that came with my new monitor are printed in several languages. One of those languages is Polish, or at least it would be Polish if&#8230; well, you&#8217;ll see. UWAGA: Szczeg&#xF3;&#xB3;owe informacje dla u&#xBF;ytkownika znajduj&#xB9; si&#xEA; na do&#xB3;&#xB9;czonej p&#xB3;ycie CD. This is garbage. What they meant to write was UWAGA: Szczeg&#xF3;&#x142;owe informacje dla u&#x17c;ytkownika [&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":[25],"class_list":["post-32103","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>The instructions that came with my new monitor are printed in several languages. One of those languages is Polish, or at least it would be Polish if&#8230; well, you&#8217;ll see. UWAGA: Szczeg&#xF3;&#xB3;owe informacje dla u&#xBF;ytkownika znajduj&#xB9; si&#xEA; na do&#xB3;&#xB9;czonej p&#xB3;ycie CD. This is garbage. What they meant to write was UWAGA: Szczeg&#xF3;&#x142;owe informacje dla u&#x17c;ytkownika [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/32103","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=32103"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/32103\/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=32103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=32103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=32103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}