htmlentities

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
from django import template
from django.utils.html import escape
from django.utils.safestring import mark_safe


register = template.Library()


@register.filter()
def htmlentities(s):
    return mark_safe(escape(s).encode('ascii', 'xmlcharrefreplace'))

More like this

  1. Improved Pickled Object Field by taavi223 3 years, 9 months ago
  2. Convert Unicode to ASCII by coordt 5 years, 3 months ago
  3. Dynamic Regroup Template Tag by btaylordesign 1 year, 9 months ago
  4. Amazon S3 browser-based upload form(FIXED) by grillermo 7 months, 3 weeks ago
  5. Character encoding fix by mrtron 5 years ago

Comments

(Forgotten your password?)