summaryrefslogtreecommitdiff
path: root/pygments/lexer.py
diff options
context:
space:
mode:
authorgbrandl <devnull@localhost>2008-09-19 18:34:45 +0000
committergbrandl <devnull@localhost>2008-09-19 18:34:45 +0000
commitf217fdc4eefa21b66a8767bc74e7d89edc67f927 (patch)
treea159d181cc4159db35b3a64997e9e8d03b01acf1 /pygments/lexer.py
parente6600347dac8dddc630cac6e55c08dea84b20f00 (diff)
downloadpygments-f217fdc4eefa21b66a8767bc74e7d89edc67f927.tar.gz
Fix newline problem.
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')