{"id":239,"date":"2012-06-27T22:41:43","date_gmt":"2012-06-28T05:41:43","guid":{"rendered":"http:\/\/shanelabs.com\/blog\/?p=239"},"modified":"2012-06-27T22:43:57","modified_gmt":"2012-06-28T05:43:57","slug":"weird-characters-on-my-site","status":"publish","type":"post","link":"https:\/\/shanelabs.com\/blog\/2012\/06\/27\/weird-characters-on-my-site\/","title":{"rendered":"Weird characters on my site"},"content":{"rendered":"<p>Every once in a while I get a submission to <a href=\"http:\/\/www.songkeyfinder.com\">Song Key Finder<\/a>\u00a0that contains some weird characters (they showed up as boxes). I use the MusicBrainz database api to verify song and artist information, so my first thought was to consult with them. Since the characters appeared to be showing up in non-english songs, I looked into their international information:<\/p>\n<blockquote><p>MusicBrainz uses\u00a0<a href=\"http:\/\/en.wikipedia.org\/wiki\/UTF-8\" target=\"_blank\">UTF-8<\/a>\u00a0for all its data, which means that all the data is stored in Unicode and supports lots of different languages.<\/p><\/blockquote>\n<p>Got it. So now that I know their info is in UTF-8 I needed to make sure my page was being interpreted with that. Smashing Magazine provided a <a href=\"http:\/\/www.smashingmagazine.com\/2012\/06\/06\/all-about-unicode-utf8-character-sets\/\">great article<\/a> about character encodings which explains everything!<\/p>\n<blockquote><p>All the encoding problems&#8230;are caused by text being submitted in one character set and viewed in another. The solution is to\u00a0<strong>make sure that every page on your website uses UTF-8<\/strong>. You can do this with one of these lines immediately after the\u00a0<code>&lt;head&gt;<\/code>\u00a0tag:<\/p>\n<pre>&lt;meta charset=\"UTF-8\"&gt;\r\n&lt;meta http-equiv=\"Content-type\" content=\"text\/html; charset=UTF-8\"&gt;<\/pre>\n<p>It has to be one of the first things in your Web page, as it will cause the browser to look again at the page in a whole new light. For speed and efficiency, it should do this as soon as possible.<\/p><\/blockquote>\n<p>So all I had to do was just add this as the first line to the head, and all the weird characters started showing up normally (most were accented a&#8217;s and e&#8217;s)!<\/p>\n<blockquote><p>&lt;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text\/html; charset=utf-8&#8243; \/&gt;<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Every once in a while I get a submission to Song Key Finder\u00a0that contains some weird characters (they showed up as boxes). I use the MusicBrainz database api to verify song and artist information, so my first thought was to consult with them. Since the characters appeared to be showing up in non-english songs, I [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[3,4],"tags":[],"class_list":["post-239","post","type-post","status-publish","format-standard","hentry","category-software","category-web"],"_links":{"self":[{"href":"https:\/\/shanelabs.com\/blog\/wp-json\/wp\/v2\/posts\/239","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shanelabs.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shanelabs.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shanelabs.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/shanelabs.com\/blog\/wp-json\/wp\/v2\/comments?post=239"}],"version-history":[{"count":5,"href":"https:\/\/shanelabs.com\/blog\/wp-json\/wp\/v2\/posts\/239\/revisions"}],"predecessor-version":[{"id":243,"href":"https:\/\/shanelabs.com\/blog\/wp-json\/wp\/v2\/posts\/239\/revisions\/243"}],"wp:attachment":[{"href":"https:\/\/shanelabs.com\/blog\/wp-json\/wp\/v2\/media?parent=239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shanelabs.com\/blog\/wp-json\/wp\/v2\/categories?post=239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shanelabs.com\/blog\/wp-json\/wp\/v2\/tags?post=239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}