{"id":3885,"date":"2016-04-25T01:01:34","date_gmt":"2016-04-25T01:01:34","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=3885"},"modified":"2016-04-25T01:01:34","modified_gmt":"2016-04-25T01:01:34","slug":"fixing-python-error-charmap-codec-cant-decode-byte-0x9d-position-12180-character-maps","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/fixing-python-error-charmap-codec-cant-decode-byte-0x9d-position-12180-character-maps\/","title":{"rendered":"Fixing python error: &#8216;charmap&#8217; codec can&#8217;t decode byte 0x9d in position 12180: character maps to"},"content":{"rendered":"<p>When running python code, you can get unicode errors like so:<\/p>\n<pre>\n'charmap' codec can't decode byte 0x9d in position 12180: character maps to <undefined>\n<\/pre>\n<pre>\n'charmap' codec can't encode character '\\u2019' in position 305: character maps to <undefined>\n<\/pre>\n<p>If this comes from reading a file, you can check the file&#8217;s encoding and change how you read the file:<\/p>\n<pre lang=\"bash\">\n$ file -i talk200.html\ntalk200.html: text\/html; charset=utf-8\n<\/pre>\n<pre lang=\"python\">\nopen(file, encoding=\"utf-8\")\n<\/pre>\n<p>This also can happen if the terminal window can&#8217;t display unicode characters. If you&#8217;re using Visual Studio or the Windows Command prompt, the best option is to switch to something better, like iPython Notebook \/ QtConsole.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Getting around annoying unicode errors in python<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[9],"tags":[447,561],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/3885"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=3885"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/3885\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=3885"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=3885"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=3885"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}