summaryrefslogtreecommitdiff
path: root/bs4/dammit.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2012-07-03 15:10:36 -0400
committerLeonard Richardson <leonardr@segfault.org>2012-07-03 15:10:36 -0400
commitef51996386270f8bc3d7b4e4272d8b117b4f41af (patch)
tree4570b2214c25707d3f090fb731d335f64e0fdbcd /bs4/dammit.py
parentfad4290ac93a33d7052ea1c7a73fb992b9579c3a (diff)
Use logging.warning() instead of warning.warn() to notify the user that characters were replaced with REPLACEMENT CHARACTER. [bug=1013862]
Diffstat (limited to 'bs4/dammit.py')
-rw-r--r--bs4/dammit.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/bs4/dammit.py b/bs4/dammit.py
index 58cad9b..67ce66c 100644
--- a/bs4/dammit.py
+++ b/bs4/dammit.py
@@ -10,7 +10,7 @@ encoding; that's the tree builder's job.
import codecs
from htmlentitydefs import codepoint2name
import re
-import warnings
+import logging
# Autodetects character encodings. Very useful.
# Download from http://chardet.feedparser.org/
@@ -226,10 +226,9 @@ class UnicodeDammit:
if proposed_encoding != "ascii":
u = self._convert_from(proposed_encoding, "replace")
if u is not None:
- warnings.warn(
- UnicodeWarning(
+ logging.warning(
"Some characters could not be decoded, and were "
- "replaced with REPLACEMENT CHARACTER."))
+ "replaced with REPLACEMENT CHARACTER.")
self.contains_replacement_characters = True
break