skip to navigation
skip to content

namedentities 1.2

Converts numeric HTML entities and Unicode characters to nice, neat named HTML entities

Latest Version: 1.9.4

Named HTML entities are much neater and much easier to comprehend than numeric entities. And because they fall within the ASCII range, they’re much safer to use in multiple contexts than Unicode and its various encodings (UTF-8 and such).

This module helps convert from numerical HTML entites and Unicode characters that fall outside the normal ASCII range into named entities.


Python 2:

from namedentities import named_entities

u = u'both em\u2014and–dashes…'
print named_entities(u)


both em—and–dashes…

Python 3:

from namedentities import named_entities

u = 'both em\u2014and–dashes…'
# same result

Or using the six cross-version compatibility library, either one:

from namedentities import named_entities
import six

u = six.u('both em\u2014and–dashes…')
# same result

Recent Changes

  • Now successfully packaged for, and tests against, against Python 2.5, 2.6, 2.7, 3.2, and 3.3.
  • Commenced automated multi-version testing with pytest and tox.


  • Doesn’t attempt to encode <, >, or & (or their numerical equivalents) to avoid interfering with HTML escaping.
  • This is basically a packaging of Ian Beck’s work. Thank you, Ian!


pip install namedentities

To easy_install under a specific Python version (3.3 in this example):

python3.3 -m easy_install namedentities

(You may need to prefix these with “sudo ” to authorize installation.)

File Type Py Version Uploaded on Size
namedentities-1.2.tar.gz (md5) Source 2012-10-15 3KB (md5) Source 2012-10-15 8KB