> > You need to replace the `\w` with something that will match the characters 
> > you
> > want. If you want everything that `\w` matches plus spaces, you should use
> > `[\w ]+` (note the space) instead of `\w+`.

What about other unicode characters? Such as special characters in
other languages? I'm developing a search engine which searches for
files inside Linux packages. Whenever somebody enters a Turkish
character as a search term, urls.py can't handle that. Somebody [1]
has found a workaround by accepting everything except for "/" in the
url. But I'm wondering if it could be dangerous for me as I'm doing a
database search.

My url patterns used to be like:

    (r'^(?P<version>[-0-9A-Za-z]+)/(?P<term>[-_.0-9A-Za-z]+)/$',
'search_in_all_packages'),

Then I tried appending special characters, and some encoding stuff:
    (r'^(?P<version>[-0-9A-Za-z]+)/(?P<term>[-_.0-9A-Za-zıİğĞüÜşŞöÖçÇ ]
+)/$', 'search_in_all_packages')
then
    (u'^(?P<version>[-0-9A-Za-z]+)/(?P<term>[-_.0-9A-Za-zıİğĞüÜşŞöÖçÇ ]
+)/$', 'search_in_all_packages').encode("utf-8")

but none of them worked.

[1] http://blog.tkbe.org/archive/django-international-characters-in-urls
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to