diff --git a/trafilatura/utils.py b/trafilatura/utils.py index 386996d2..3b8bbc04 100644 --- a/trafilatura/utils.py +++ b/trafilatura/utils.py @@ -284,10 +284,10 @@ def sanitize(text, preserve_space=False, trailing_space=False): '''Convert text and discard incompatible and invalid characters''' # consider all text as a single line if trailing_space: - return line_processing(text, preserve_space, trailing_space) + return line_processing(text, preserve_space, True) # process line by line try: - return '\n'.join(filter(None, (line_processing(l, preserve_space, trailing_space) for l in text.splitlines()))) + return '\n'.join(filter(None, (line_processing(l, preserve_space) for l in text.splitlines()))) except AttributeError: return None