{"id":110769,"date":"2025-01-15T11:05:59","date_gmt":"2025-01-15T19:05:59","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/oldnewthing\/?p=110769"},"modified":"2025-01-15T11:05:59","modified_gmt":"2025-01-15T19:05:59","slug":"20250115-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20250115-59\/?p=110769","title":{"rendered":"How does <CODE>Get&shy;User&shy;Default&shy;Geo&shy;Name<\/CODE> choose between ISO 3166-1 and UN M.49 codes?"},"content":{"rendered":"<p>The documentation for the <code>Get\u00adUser\u00adDefault\u00adGeo\u00adName<\/code> function says<\/p>\n<blockquote class=\"q\"><p>Retrieves the two-letter International Organization for Standardizationo(ISO) 3166-1 code or numeric United Nations (UN) Series M, Number 49 (M.49) code for the default geographical location of the user.<\/p><\/blockquote>\n<p>There is no description about how the system chooses between them, so it sounds like the system internally flips a coin and picks one, so the code needs to be prepared for anything!<\/p>\n<p>What happens is that the <code>Get\u00adUser\u00adDefault\u00adGeo\u00adName<\/code> function returns the two-letter ISO 3166-1 code if one has been assigned. If the assigned code is XX, the convention used by <a href=\"https:\/\/www.wipo.int\/\">WIPO<\/a> for regions with no assigned code, then the function uses the UN M.49 code if one is available. If neither is available, then the function shrugs and uses XX after all.<\/p>\n<p>I&#8217;ve submitted an update to the documentation to make this a bit clearer.<\/p>\n<p>\u00b9 There&#8217;s an edge case where the system doesn&#8217;t know what region the user is in. In that case, you get UN M.49 code 001, which means &#8220;Somewhere in the world.&#8221;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Clarifying the behavior.<\/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-110769","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Clarifying the behavior.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/110769","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=110769"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/110769\/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=110769"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=110769"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=110769"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}