use encoding method

unicode(str).encde("UTF-8")




On Mon, Apr 5, 2010 at 12:59 PM, Willem <mati...@gmail.com> wrote:

> I get following error:
>
> "Caught UnicodeEncodeError while rendering: 'ascii' codec can't encode
> character u'\xe1' in position 161: ordinal not in range(128)"
>
>
> If I comment out the cache line in template -- all is OK
> Any ideas?
>
> Many thanks
>
> -----------------
>
> DETAIL:
>
> Line 24 in template below:
>
> 23
> 24      {% cache  86400 html_people_country1 country %}
> 25
> 26      var people = [
> 27
> 28      {% for profile in profile_list %}
> 29          [{{ profile.latitude }}, {{ profile.longitude }},
> "{{ profile.user.first_name }} {{ profile.user.last_name }}", "people/
> {{ profile.user.username }}", "{{ profile.location }}", "/files/img/
> bosveld.jpg", "{{ profile.country.shortcode }}",
> {{ profile.zoomlevel }}]{% if not forloop.last %},{% endif %}
> 30      {% endfor %}
> 31
> 32      ];
> 33
> 34      {% endcache %}
>
>
> TRACEBACK:
>
> /usr/local/lib/python2.5/site-packages/django/templatetags/cache.py in
> render
>            cache.set(cache_key, value, expire_time) ...
> /usr/local/lib/python2.5/site-packages/django/core/cache/backends/
> memcached.py in set
>        self._cache.set(smart_str(key), value,
> self._get_memcache_timeout(timeout)) ...
>
>
> Looking at the variables in traceback:
> {{ profile.location }} = "Bogot\xe1"
>
>
> Django 1.2.0 beta  1
> Python 2.5.2
> MySQL 5.xx
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to