{"id":919,"date":"2020-12-11T21:42:09","date_gmt":"2020-12-11T21:42:09","guid":{"rendered":"https:\/\/potatodie.nl\/diffuse-write-ups\/?p=919"},"modified":"2020-12-11T21:55:45","modified_gmt":"2020-12-11T21:55:45","slug":"about-charset-utf-8","status":"publish","type":"post","link":"https:\/\/potatodie.nl\/diffuse-write-ups\/about-charset-utf-8\/","title":{"rendered":"About charset UTF-8"},"content":{"rendered":"\n<p>The first line of the head element of a html document is usually<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;meta charset=\"UTF-8\" \/&gt;   <\/pre>\n\n\n\n<p>What does it do?<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Unicode<\/h2>\n\n\n\n<p>Unicode lists characters. Each character in the list corresponds with a number. The encoding UTF-8 determines how these numbers are stored in computer files\/memory.<\/p>\n\n\n\n<p><strong>Example 1<\/strong>: The letter z is listed as number 122. It is stored as a single byte:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">01111010<\/pre>\n\n\n\n<p>The first 128 characters are the same in all encodings (basic Latin), so the letter z would be save without a charset specification.<\/p>\n\n\n\n<p><strong>Example <\/strong>2: The character \u00e9 is number 233 of the unicode list, stored as<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">11000011 10101001<\/pre>\n\n\n\n<p><strong>Example 3:<\/strong> The Kannada letter \u0c8a has number 3210. It&#8217;s stored as<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">11100000 10110010 10001010<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">HTML-codes and entities<\/h3>\n\n\n\n<p>HTML-codes use Unicode, independent of the character set used. So if you type <code>&amp;#3210;<\/code> you&#8217;ll get \u0c8a even if you omit the charset meta tag or choose another one, like iso-8859<\/p>\n\n\n\n<p>For \u00e9 you may also use the HTML-code <code>&amp;#233;<\/code> or the HTML entity <code>&amp;eacute;<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Is UTF-8 the default?<\/h2>\n\n\n\n<p>It&#8217;s sometimes stated that UTF-8 is the default character encoding for HTML5. But it isn&#8217;t. Not in the sense that it will be active if you don&#8217;t specify it. So make sure the tag is always present as the first child of <code>head<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Some links<\/h2>\n\n\n\n<p><a href=\"https:\/\/unicode-table.com\">https:\/\/unicode-table.com<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/blog.whatwg.org\/the-road-to-html-5-character-encoding\">https:\/\/blog.whatwg.org\/the-road-to-html-5-character-encoding<\/a><\/p>\n\n\n\n<div class=\"wp-block-group is-layout-flow wp-block-group-is-layout-flow\"><div class=\"wp-block-group__inner-container\"><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Simple explanation of Unicode and character encodings <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-919","post","type-post","status-publish","format-standard","hentry","category-web-development"],"acf":[],"_links":{"self":[{"href":"https:\/\/potatodie.nl\/diffuse-write-ups\/wp-json\/wp\/v2\/posts\/919","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/potatodie.nl\/diffuse-write-ups\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/potatodie.nl\/diffuse-write-ups\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/potatodie.nl\/diffuse-write-ups\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/potatodie.nl\/diffuse-write-ups\/wp-json\/wp\/v2\/comments?post=919"}],"version-history":[{"count":6,"href":"https:\/\/potatodie.nl\/diffuse-write-ups\/wp-json\/wp\/v2\/posts\/919\/revisions"}],"predecessor-version":[{"id":927,"href":"https:\/\/potatodie.nl\/diffuse-write-ups\/wp-json\/wp\/v2\/posts\/919\/revisions\/927"}],"wp:attachment":[{"href":"https:\/\/potatodie.nl\/diffuse-write-ups\/wp-json\/wp\/v2\/media?parent=919"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/potatodie.nl\/diffuse-write-ups\/wp-json\/wp\/v2\/categories?post=919"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/potatodie.nl\/diffuse-write-ups\/wp-json\/wp\/v2\/tags?post=919"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}