summaryrefslogtreecommitdiff
path: root/pygments/lexer.py
diff options
context:
space:
mode:
Diffstat (limited to 'pygments/lexer.py')
-rw-r--r--pygments/lexer.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/pygments/lexer.py b/pygments/lexer.py
index 5c41d4a2..cba93e4f 100644
--- a/pygments/lexer.py
+++ b/pygments/lexer.py
@@ -127,10 +127,9 @@ class Lexer(object):
Also preprocess the text, i.e. expand tabs and strip it if
wanted and applies registered filters.
"""
- if isinstance(text, unicode):
- text = u'\n'.join(text.splitlines())
- else:
- text = '\n'.join(text.splitlines())
+ text = text.replace('\r\n', '\n')
+ text = text.replace('\r', '\n')
+ if not isinstance(text, unicode):
if self.encoding == 'guess':
try:
text = text.decode('utf-8')