Saturday, February 6, 2016

Re: reading CSV file with non ASCII characters

On Sat, Feb 6, 2016 at 5:38 AM, Tim Chase
<django.users@tim.thechases.com> wrote:
> On 2016-02-06 03:06, elcaiaimar wrote:
>> import unicodecsv as csv
>>
>> csvfile=open("mediosdigitales.csv")
>
>> > reader = csv.DictReader(open("file.csv", "rb"))
>
>> reader = csv.reader(csvfile, encoding='utf-8', delimiter=',')

Do you actually know that the character encoding of the file is utf_8?

If the file is coming from a Western European (including English)
system, it could easily be cp_1252.

https://docs.python.org/3/library/codecs.html

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJ4%2B4apZPFzpYg6gqynchVt9j5URVfAT0pPrvX9V8s%3Dj-JmPyQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment