Tuesday, May 1, 2012

Re: HELP with unicode!!!!!

Hi,
  it may because of the csv file sometimes, try to save the file as utf-8 or utf-8 no-bom.



On Tue, May 1, 2012 at 7:08 PM, dizzydoc <htc.karanagarwal@gmail.com> wrote:
Hi ,

i have lost a lot of time looking for a solution.

My problem is, while i a reading csv in python using

csv_file  = open(path_file, "rb")
reader = csv.reader(csv_file)

whenever i perform any operation on the string returned in each cell i
get this error

*** UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0'
in position 34: ordinal not in range(128)

i tried decoding the value as

val.decode('utf-8')

...this helped to reduce a few encodings but gets stuck for
the encoding "\xa0"
Please HELP!

Thanks

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment