diff options
author | gbrandl <devnull@localhost> | 2009-03-31 10:26:55 -0500 |
---|---|---|
committer | gbrandl <devnull@localhost> | 2009-03-31 10:26:55 -0500 |
commit | 7b95efab48d9ec79e995bf4d6db10fd049e3395a (patch) | |
tree | 48fc9b840dab83976a85af85d1c705dbaa051a0b /pygments/lexer.py | |
parent | f12c878ed096137c91658a0f62f0070e08c2afea (diff) | |
download | pygments-7b95efab48d9ec79e995bf4d6db10fd049e3395a.tar.gz |
Port Pygments to Python 3.1.
Diffstat (limited to 'pygments/lexer.py')
-rw-r--r-- | pygments/lexer.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/pygments/lexer.py b/pygments/lexer.py index 053df0fd..cf5115f1 100644 --- a/pygments/lexer.py +++ b/pygments/lexer.py @@ -127,8 +127,6 @@ class Lexer(object): Also preprocess the text, i.e. expand tabs and strip it if wanted and applies registered filters. """ - text = text.replace('\r\n', '\n') - text = text.replace('\r', '\n') if not isinstance(text, unicode): if self.encoding == 'guess': try: @@ -148,6 +146,9 @@ class Lexer(object): text = text.decode(enc['encoding']) else: text = text.decode(self.encoding) + # text now *is* a unicode string + text = text.replace('\r\n', '\n') + text = text.replace('\r', '\n') if self.stripall: text = text.strip() elif self.stripnl: |