On Wed, 2010-07-07 at 21:27 +0800, Russell Keith-Magee wrote:
> On Wed, Jul 7, 2010 at 4:00 AM, C. Alan Zoppa <alan.zo...@gmail.com> wrote:
> > I occasionally enter special characters as HTML entities (e.g. &ldquo;,
> > &reg;, etc.) in an object's title. I feel that slugify() would be more
> > useful if these were removed entirely from the returned slug. For example:
> > At the moment, a title of &ldquo;Object Title &rdquo; returns the slug
> > "ldquoobject-titlerdquo." It is my opinion that "object-title" would be more
> > useful in this situation.
> 
> I can't think of any way that ldquo et al could be considered helpful
> in a slug, so yes -- this sounds like a bug to me.
> 

Really?  I thought Jerome was right here - slugify should be applied
*before* escaping.  Alan seems to be storing HTML in the model itself,
if I understand correctly, and wanting the HTML escaped string to
produce nice slugs with slugify.  That would require slugify to
un-HTML-escape first, which would strictly speaking be incorrect for
some people. (e.g. the pathological case - a blog post with the title
"Why you see &lt; and &gt; in RSS feeds" - the slug would be
why-you-see-lt-and-gt-in-rss-feeds, not why-you-see-and-in-rss-feeds)

The normal way to do this is to store special characters as unicode
characters, and apply slugify to that, which works fine.

Luke

-- 
"Where a person wishes to attract, they should always be ignorant." 
(Jane Austen)

Luke Plant || http://lukeplant.me.uk/

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to