Opened 18 years ago

Closed 18 years ago

#2215 closed enhancement (wontfix)

[patch] django.utils.html.escape does not escape non-english characters properly

Reported by: Matias Hermanrud Fjeld <mhf@…> Owned by: Adrian Holovaty
Component: Tools Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This patch makes django.utils.html.escape use pythons htmlentitydefs module to know what to escape.

Characters like æ, ø, å and alot of other non-english letters are escaped properly:

>>> from django.utils.html import escape
>>> escape('<p>æøå</p>')
'&lt;p&gt;&aelig;&oslash;&aring;&lt;/p&gt;'

It would be nice to use generators here, but alas.

Attachments (1)

django-escape.diff (1.1 KB ) - added by Matias Hermanrud Fjeld <mhf@…> 18 years ago.

Download all attachments as: .zip

Change History (3)

by Matias Hermanrud Fjeld <mhf@…>, 18 years ago

Attachment: django-escape.diff added

comment:1 by Matias Hermanrud Fjeld <mhf@…>, 18 years ago

Summary: [patch] django.utils.html.escape does not escape non-english characers properly[patch] django.utils.html.escape does not escape non-english characters properly

comment:2 by Jacob, 18 years ago

Resolution: wontfix
Status: newclosed

Entities don't need to be "escaped" to be used in HTML as long as you've got the right encoding. This might be worth added as a seperate filter, but it doesn't belong in escape.

Note: See TracTickets for help on using tickets.
Back to Top