{"id":2118,"date":"2014-03-04T13:38:28","date_gmt":"2014-03-04T13:38:28","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=2118"},"modified":"2014-03-04T13:38:28","modified_gmt":"2014-03-04T13:38:28","slug":"unicodeencodeerror-ascii-codec-cant-encode-character-uxe1-position-8-ordinal-range128","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/unicodeencodeerror-ascii-codec-cant-encode-character-uxe1-position-8-ordinal-range128\/","title":{"rendered":"UnicodeEncodeError: &#8216;ascii&#8217; codec can&#8217;t encode character u&#8217;\\xe1&#8242; in position 8: ordinal not in range(128)"},"content":{"rendered":"<p>If you do the following:<\/p>\n<pre lang=\"python\">\n[str(x) for x in data]\n<\/pre>\n<p>You&#8217;ll sometimes get this error:<\/p>\n<pre>\nUnicodeEncodeError: 'ascii' codec can't encode character u'\\xe1' in position 8: ordinal not in range(128)\n<\/pre>\n<p>This indicates that you have non-ascii characters in the data, and should use a wider type. You can fix it by doing the following (alternately, you can do something like base64 encoding, although I&#8217;m not sure why you&#8217;d want to do that):<\/p>\n<pre lang=\"python\">\n[unicode(x) for x in data]\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>If you do the following: [str(x) for x in data] You&#8217;ll sometimes get this error: UnicodeEncodeError: &#8216;ascii&#8217; codec can&#8217;t encode character u&#8217;\\xe1&#8242; in position 8: ordinal not in range(128) This indicates that you have non-ascii characters in the data, and should use a wider type. You can fix it by doing the following (alternately, you &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.garysieling.com\/blog\/unicodeencodeerror-ascii-codec-cant-encode-character-uxe1-position-8-ordinal-range128\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;UnicodeEncodeError: &#8216;ascii&#8217; codec can&#8217;t encode character u&#8217;\\xe1&#8242; in position 8: ordinal not in range(128)&#8221;<\/span><\/a><\/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":[4],"tags":[198,447],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/2118"}],"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=2118"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/2118\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=2118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=2118"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=2118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}