On Tue, 2008-07-15 at 19:22 +0200, Fernando Rodríguez wrote:
> El mar, 15-07-2008 a las 12:25 -0400, Ned Batchelder escribió:
>
> > You're misunderstanding the role of the escape filter. It isn't meant
> > to create HTML entities for accented characters. All it does is escape
> > characters that could be dangerous for XSS attacks (" ' < > &). And by
> > the way, in the latest code, escaping is automatic, so you may not need
> > it at all.
>
> OK, thanks. That makes sense.
>
> However, I still need to convert those accented character into html
> entities. Is there any pre-built filter for this? I checked the
> refrence in "The definitive guide to django" but saw none.
>
> I can't be the first one in need of this...
Well, you probably aren't, but it's worth realising why this isn't
something Django does automatically (or is likely to include in core):
HTML supports UTF-8 and has done pretty much forever, which means such
conversion to entities isn't required on an HTML or browser-level. The
main reason for requiring such a conversion in the "good old days" was
so that the source file was encoded in 7-bit ASCII. Here in the 21st
century, saving non-ASCII files (and non-ASCII data in databases) is
pretty much a solved problem in everyday systems, so it's become much
less of a requirement.
I'm definitely not saying you definitely don't need this, but make sure
that you're doing it for the right reasons. Sending UTF-8 in all of it's
non-entity-encoded glory is very normal practice.
Regards,
Malcolm
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---