in my urls.py I use
(r'^shop/(?P<shop_name>.*?)/(?P<category_name>.*?)/','shopproject.apps.shop.views.shop.IndexByCategory'),
where
category_name
can consist non English characters.In my view i use
def IndexByCategory(request,shop_name,category_name):
...
...
I noted that in my browser address bar that category_name is not
properly coded ( if consists non-English characters) and I can not use
F5( refresh) either.
Anyone solved that problem?
Thank you for help.
L.
generally such situations are solved using a SlugField.. which is a
textfield that can only contain alphanumeric characters + the minus-sign
i think. so with those there are no url problems.
now back to your problem.
generally, having non-ascii characters in the URLs is problematic.
usually if they are in utf8, there's a chance that they will be displayed.
but then it also depends on the browser, for example firefox
(intentionally) does not display them correctly...
so i would recommend you to use a SlugField, if possible.
if it's not possible, and my advice did not help, please describe to us:
- the charset you use in the URL
- which browser
- an actual example (an url that exhibits the problem)
gabor
Actually, in this case there are multiple "correct" ways to display
the characters; one is to render the Unicode glyphs, which is what
Safari does, for example, and another is to show the characters in
URL-encoded format, which is what Firefox does. There are pros and
cons to each method which are probably beyond the scope of this
discussion.
--
"May the forces of evil become confused on the way to your house."
-- George Carlin
you're absolutely correct. now reading back my response, the word
'correctly' was maybe not the best word for that situation :)
gabor