#16501: validators.py don't like unicode slug
-------------------------------------+-------------------------------------
Reporter: norn | Owner: nobody
Type: Bug | Status: new
Milestone: | Component: Core (Other)
Version: 1.3 | Severity: Normal
Resolution: | Keywords: unicode, slug
Triage Stage: Design | Has patch: 0
decision needed | Needs tests: 0
Needs documentation: 0 | Easy pickings: 0
Patch needs improvement: 0 |
UI/UX: 0 |
-------------------------------------+-------------------------------------
Changes (by aaugustin):
* stage: Unreviewed => Design decision needed
Comment:
Replying to [comment:2 anonymous]:
> The world is not english speaking only.
Sure — as a native speaker of a language that uses accents heavily, I
agree completely :)
[[BR]]
> Why do we have to do some magic instead of using out-of-the-box
functionality?
Well, if you don't like the out-of-the-box functionality that everyone
else uses, it sounds reasonable to write you own variant. There's hardly
any magic in my suggestion.
----
Replying to [comment:3 justinlilly]:
> Non-ASCII letters are completely valid in URL schemes.
Yes, since RFC 3986, it's possible to use non-ASCII characters in URLs
without ambiguities: the charset must be UTF-8.
That RFC was published is 2005. Browser vendors may not have changed it
immediately (historically, most browsers defaulted to latin1 in western
languages), and some people still use browsers from a few years ago. I
don't know exactly what's the current status. We need to check how
mainstream browsers react to an URL like "http://localhost/how-to-brew-
café/" before proceeding: do they properly utf-8-encode and percent-encode
it?
[[BR]]
> The whole point of a slug isn't to contain ASCII letters. It is merely
to provide a human-readable URL entry. There are plenty of humans who read
outside of ASCII.
I'm a bit confused by this. Django provides a `SlugField` that is designed
to contain an URL-friendly version of a `CharField`. For instance, the
title of a blog post could be "How to brew café" (in the `CharField`) and
the slug would be "how-to-brew-cafe" (in the `SlugField`). If you assume
that an URL can contain any text, you don't need `SlugField` at all; you
can just use the original title.
A drawback is that the actual, correct URL is: http://localhost/how-to-
brew-caf%C3%A9/. Some browsers may percent-decode and utf-8-decode this to
display it as: http://localhost/how-to-brew-café/ — I think at least
Firefox does. I don't know about IE. If it turns out we have to choose
between http://localhost/how-to-brew-caf%C3%A9/ and http://localhost/how-
to-brew-cafe/, I think the latter is more readable.
[[BR]]
> Also, aaugustin, your tone came off a little combative/hostile. I'm sure
you didn't mean it that way, but that's how it came out. Just a heads up.
Thanks for the hint and sorry -- the tone of the original report got a bit
on my nerves. Comment 2 is great too... :)
--
Ticket URL: <https://code.djangoproject.com/ticket/16501#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.