Code

Opened 5 years ago

Closed 5 years ago

#9891 closed (wontfix)

Add entity2unicode in `django.utils.html`

Reported by: rafael+django@… Owned by: nobody
Component: Uncategorized Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The html utils of Django could have this function:

import htmlentitydefs
entity_re = re.compile('&([a-z]+);', re.I)
def entity2unicode(text):
    for entity in entity_re.findall(text):
        print entity
        text = text.replace('&%s;'%entity, htmlentitydefs.entitydefs[entity].decode('iso-8859-1'))
    return text

Maybe it could be useful for someone else

Attachments (0)

Change History (1)

comment:1 Changed 5 years ago by jacob

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

Things in django.utils are mostly support functions for Django itself, not functions designed for external use.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.