{"id":339,"date":"2009-07-03T12:16:59","date_gmt":"2009-07-03T17:16:59","guid":{"rendered":"http:\/\/vgable.com\/blog\/?p=339"},"modified":"2009-07-03T12:17:08","modified_gmt":"2009-07-03T17:17:08","slug":"when-in-doubt-utf8","status":"publish","type":"post","link":"https:\/\/vgable.com\/blog\/2009\/07\/03\/when-in-doubt-utf8\/","title":{"rendered":"When In Doubt, UTF8"},"content":{"rendered":"<blockquote>\n<pre>\n\/* If you are uncertain of the correct encoding, you should use UTF-8, *\/\n\/* which is the encoding designated by <a href=\"http:\/\/www.faqs.org\/rfcs\/rfc2396.html\">RFC 2396<\/a> as the correct encoding *\/\n\/* for use in URLs.\u2026 *\/\n<\/pre>\n<\/blockquote>\n<p>&#8212; <a href=\"http:\/\/www.opensource.apple.com\/source\/CF\/CF-476.15\/CFURL.h\"><code>CFURL.h<\/code><\/a><\/p>\n<p>This echos my experience, <strong>when in doubt, choose <a href=\"http:\/\/en.wikipedia.org\/wiki\/UTF-8\">UTF8<\/a> for the web<\/strong>. UTF8 is backwards compatible with 7-bit ASCII (eg. &#8216;A&#8217; is 0x41 in ASCII and UTF8).<\/p>\n<p>But know that UTF8 is a variable-length encoding: non-ASCII <strong>characters maybe represented by > 1 byte<\/strong>. As a general rule with Unicode, I <strong>do <em>not<\/em> expect a <code>char<\/code> or <code>wchar_t<\/code> to always map to a character in a string<\/strong>. Encoding details can be messy, e.g. &#8220;\u00c9&#8221; might be represented as one character, or two composed characters &#8220;\u00b4E&#8221;. It never hurts to <a href=\"http:\/\/www.codinghorror.com\/blog\/archives\/001084.html\">brush up on Unicode<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\/* If you are uncertain of the correct encoding, you should use UTF-8, *\/ \/* which is the encoding designated by RFC 2396 as the correct encoding *\/ \/* for use in URLs.\u2026 *\/ &#8212; CFURL.h This echos my experience, when in doubt, choose UTF8 for the web. UTF8 is backwards compatible with 7-bit ASCII [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,4],"tags":[165,142,163,164,60],"class_list":["post-339","post","type-post","status-publish","format-standard","hentry","category-accessibility","category-programming","tag-ascii","tag-i18n","tag-unicode","tag-utf8","tag-web"],"_links":{"self":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts\/339","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/comments?post=339"}],"version-history":[{"count":1,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts\/339\/revisions"}],"predecessor-version":[{"id":340,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts\/339\/revisions\/340"}],"wp:attachment":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/media?parent=339"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/categories?post=339"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/tags?post=339"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}