Tuesday, March 29, 2011

Re: unicode question

I can't explain the additional space, but URL-encoding a Unicode string isn't generally possible, it needs to be encoded first.  UTF-8 is almost always the correct encoding to use, so in your case:
 qk = quote(query_text.encode('utf8'))

Anything you can do to avoid having to include text like that in a URL (e.g. maybe it could be saved to a model instance, and recovered via an id or a slug?) would often be a better option.

Hope that helps
George

--
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