diff options
-rw-r--r-- | beautifulsoup/dammit.py | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/beautifulsoup/dammit.py b/beautifulsoup/dammit.py index f0690c1..0d3ebd0 100644 --- a/beautifulsoup/dammit.py +++ b/beautifulsoup/dammit.py @@ -7,6 +7,7 @@ encoding; that's the tree builder's job. """ import codecs +from htmlentitydefs import codepoint2name import re import types @@ -21,21 +22,13 @@ try: except ImportError: chardet = None -# Both are available from http://cjkpython.i18n.org/ -# They're built in if you use Python 2.4. -try: - import cjkcodecs.aliases -except ImportError: - pass +# Available from http://cjkpython.i18n.org/. try: import iconv_codec except ImportError: pass -from htmlentitydefs import codepoint2name -import re - class EntitySubstitution(object): def _populate_class_variables(): @@ -47,7 +40,6 @@ class EntitySubstitution(object): lookup[character] = name re_definition = "[%s]" % "".join(characters) return lookup, re.compile(re_definition) - CHARACTER_TO_HTML_ENTITY, CHARACTER_TO_HTML_ENTITY_RE = ( _populate_class_variables()) @@ -157,8 +149,6 @@ class EntitySubstitution(object): self._substitute_html_entity, s) - - class UnicodeDammit: """A class for detecting the encoding of a *ML document and converting it to a Unicode string. If the source encoding is |