*UPDATED* help with django and accented characters?

Posted by Asinox on Stack Overflow See other posts from Stack Overflow or by Asinox
Published on 2010-06-14T02:39:00Z Indexed on 2010/06/14 19:52 UTC
Read the original article Hit count: 878

Hi guys, i have a problem with my accented characters, Django admin save my data without encoding to something like "á"

Example: if im trying a word like " Canción ", i would like to save in this way: Canción, and not Canción.

im usign Sociable app:

{% load sociable_tags %}

                    {% get_sociable Facebook TwitThis Google MySpace del.icio.us YahooBuzz Live as sociable_links with url=object.get_absolute_url title=object.titulo %}
                        {% for link in sociable_links %}
                            <a href="{{ link.link }}"><img alt="{{ link.site }}" title="{{ link.site }}" src="{{ link.image }}" /></a>
                        {% endfor %}

But im getting error if my object.titulo (title of the article) have a accented word.

aught KeyError while rendering: u'\xfa'

Any idea ?

i had in my SETTING:

DEFAULT_CHARSET = 'utf-8'

i had in my mysql database:

utf8_general_ci

COMPLETED ERROR:

Traceback:
File "C:\wamp\bin\Python26\lib\site-packages\django\core\handlers\base.py" in get_response
  100.                     response = callback(request, *callback_args, **callback_kwargs)
File "C:\wamp\bin\Python26\lib\site-packages\django\views\generic\date_based.py" in object_detail
  366.     response = HttpResponse(t.render(c), mimetype=mimetype)
File "C:\wamp\bin\Python26\lib\site-packages\django\template\__init__.py" in render
  173.             return self._render(context)
File "C:\wamp\bin\Python26\lib\site-packages\django\template\__init__.py" in _render
  167.         return self.nodelist.render(context)
File "C:\wamp\bin\Python26\lib\site-packages\django\template\__init__.py" in render
  796.                 bits.append(self.render_node(node, context))
File "C:\wamp\bin\Python26\lib\site-packages\django\template\debug.py" in render_node
  72.             result = node.render(context)
File "C:\wamp\bin\Python26\lib\site-packages\django\template\loader_tags.py" in render
  125.         return compiled_parent._render(context)
File "C:\wamp\bin\Python26\lib\site-packages\django\template\__init__.py" in _render
  167.         return self.nodelist.render(context)
File "C:\wamp\bin\Python26\lib\site-packages\django\template\__init__.py" in render
  796.                 bits.append(self.render_node(node, context))
File "C:\wamp\bin\Python26\lib\site-packages\django\template\debug.py" in render_node
  72.             result = node.render(context)
File "C:\wamp\bin\Python26\lib\site-packages\django\template\loader_tags.py" in render
  62.             result = block.nodelist.render(context)
File "C:\wamp\bin\Python26\lib\site-packages\django\template\__init__.py" in render
  796.                 bits.append(self.render_node(node, context))
File "C:\wamp\bin\Python26\lib\site-packages\django\template\debug.py" in render_node
  72.             result = node.render(context)
File "C:\wamp\bin\Python26\lib\site-packages\sociable\templatetags\sociable_tags.py" in render
  37.                 'link': sociable.genlink(site, **self.values),
File "C:\wamp\bin\Python26\lib\site-packages\sociable\sociable.py" in genlink
  20.         values['title'] = quote_plus(kwargs['title'])
File "C:\wamp\bin\Python26\lib\urllib.py" in quote_plus
  1228.         s = quote(s, safe + ' ')
File "C:\wamp\bin\Python26\lib\urllib.py" in quote
  1222.     res = map(safe_map.__getitem__, s)

Exception Type: TemplateSyntaxError at /noticia/2010/jun/10/matan-domingo-paquete-en-la-avenida-san-vicente-de-paul/
Exception Value: Caught KeyError while rendering: u'\xfa'

thanks, sorry with my English

© Stack Overflow or respective owner

Related posts about django

Related posts about django-models