Tuesday, May 1, 2012

Re: HELP with unicode!!!!!

Write at first line on your py file:
# -*- coding: utf-8 -*-

2012/5/1 dizzydoc <htc.karanagarwal@gmail.com>:
> 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