{"action":"created","issue":{"url":"https://api.github.com/repos/jdunck/python-unicodecsv/issues/61","labels_url":"https://api.github.com/repos/jdunck/python-unicodecsv/issues/61/labels{/name}","comments_url":"https://api.github.com/repos/jdunck/python-unicodecsv/issues/61/comments","events_url":"https://api.github.com/repos/jdunck/python-unicodecsv/issues/61/events","html_url":"https://github.com/jdunck/python-unicodecsv/issues/61","id":101295210,"number":61,"title":"unicodecsv.DictReader still throws \"UnicodeEncodeError: 'ascii' \" with unicode StringIO","user":{"login":"themantalope","id":7599879,"avatar_url":"https://avatars.githubusercontent.com/u/7599879?v=3","gravatar_id":"","url":"https://api.github.com/users/themantalope","html_url":"https://github.com/themantalope","followers_url":"https://api.github.com/users/themantalope/followers","following_url":"https://api.github.com/users/themantalope/following{/other_user}","gists_url":"https://api.github.com/users/themantalope/gists{/gist_id}","starred_url":"https://api.github.com/users/themantalope/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/themantalope/subscriptions","organizations_url":"https://api.github.com/users/themantalope/orgs","repos_url":"https://api.github.com/users/themantalope/repos","events_url":"https://api.github.com/users/themantalope/events{/privacy}","received_events_url":"https://api.github.com/users/themantalope/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-16T20:08:03Z","updated_at":"2015-08-26T13:21:24Z","closed_at":null,"body":"Here's some sample code, and the error that I'm getting\r\n\r\n```python\r\nimport unicodecsv as csv\r\nimport codecs\r\n\r\nhandle = codecs.open('a_utf8_encoded_file.txt','r','utf-8')\r\n\r\ndata = handle.read()\r\n\r\nhandle.close()\r\n\r\nf = StringIO(data)\r\n\r\nreader = csv.DictReader(f, delimiter=',')\r\n\r\nfor line in reader:\r\n  print line\r\n```\r\n\r\n\r\nAnd the error I get: \r\n\r\n```python\r\nTraceback (most recent call last):\r\n  File \"create_and_refresh_test_copy.py\", line 125, in <module>\r\n    createTests(gauth,formFileName,localTestName,localKeyName,remoteTestName,remoteKeyName)\r\n  File \"create_and_refresh_test_copy.py\", line 60, in createTests\r\n    tc = TestCreator(temp_csv_name)\r\n  File \"/home/matt/class_practice_tests/testcreator.py\", line 27, in __init__\r\n    self._parseFileString(csvFile)\r\n  File \"/home/matt/class_practice_tests/testcreator.py\", line 56, in _parseFileString\r\n    for line in reader:\r\n  File \"/usr/local/lib/python2.7/dist-packages/unicodecsv/py2.py\", line 218, in next\r\n    row = csv.DictReader.next(self)\r\n  File \"/usr/lib/python2.7/csv.py\", line 108, in next\r\n    row = self.reader.next()\r\n  File \"/usr/local/lib/python2.7/dist-packages/unicodecsv/py2.py\", line 118, in next\r\n    row = self.reader.next()\r\nUnicodeEncodeError: 'ascii' codec can't encode character u'\\u2019' in position 244: ordinal not in range(128)\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/jdunck/python-unicodecsv/issues/comments/135015840","html_url":"https://github.com/jdunck/python-unicodecsv/issues/61#issuecomment-135015840","issue_url":"https://api.github.com/repos/jdunck/python-unicodecsv/issues/61","id":135015840,"user":{"login":"vdboor","id":200303,"avatar_url":"https://avatars.githubusercontent.com/u/200303?v=3","gravatar_id":"","url":"https://api.github.com/users/vdboor","html_url":"https://github.com/vdboor","followers_url":"https://api.github.com/users/vdboor/followers","following_url":"https://api.github.com/users/vdboor/following{/other_user}","gists_url":"https://api.github.com/users/vdboor/gists{/gist_id}","starred_url":"https://api.github.com/users/vdboor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vdboor/subscriptions","organizations_url":"https://api.github.com/users/vdboor/orgs","repos_url":"https://api.github.com/users/vdboor/repos","events_url":"https://api.github.com/users/vdboor/events{/privacy}","received_events_url":"https://api.github.com/users/vdboor/received_events","type":"User","site_admin":false},"created_at":"2015-08-26T13:21:24Z","updated_at":"2015-08-26T13:21:24Z","body":"I'm getting this same error,\r\n\r\nIn `unicodecsv/py2.py`, the `unicodecsv.DictReader` first asks the orginal csv file to read the line:\r\n\r\n```\r\n    def next(self):\r\n        row = csv.DictReader.next(self)\r\n```"}}