evidens/json2csv

encode error of utf-8 source data

Ancoron84 opened this issue · 2 comments

Traceback (most recent call last):
File "json2csv.py", line 155, in
loader.write_csv(filename=outfile, make_strings=args.strings)
File "json2csv.py", line 105, in write_csv
writer.writerows(out)
File "/usr/lib64/python2.7/csv.py", line 158, in writerows
return self.writer.writerows(rows)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0131' in position 2: ordinal not in range(128)

@evidens i have also a solution for this problem. I would like to commit my solution to a separate branch but i don't have the permission.

Hello, thanks for your interest in helping. Usually what people do on Github is fork a repository, apply the fixes to that form and submit a pull request https://gist.github.com/Chaser324/ce0505fbed06b947d962. That allows a maintainer to review the code and suggest improvements.

Did you install unicodecsv as specified in the instructions? I've used this library with unicode data before and it generally works as long as you install that package and your input file is UTF-8.