summaryrefslogtreecommitdiff
path: root/pygments/lexer.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-10-08 01:18:39 +0200
committerGeorg Brandl <georg@python.org>2014-10-08 01:18:39 +0200
commitc0ffb8a5babc8e6d1c58b92810f1cc11ae96ff85 (patch)
tree5a749b88bdba5d7c361c655febcdfc7f90cd9cf4 /pygments/lexer.py
parent2dd7a2b6b1aa538dc9fea6ca581a4657ccd7baf7 (diff)
downloadpygments-c0ffb8a5babc8e6d1c58b92810f1cc11ae96ff85.tar.gz
Closes #800: Add "inencoding" option to override "encoding".
Diffstat (limited to 'pygments/lexer.py')
-rw-r--r--pygments/lexer.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/pygments/lexer.py b/pygments/lexer.py
index 8d781e85..d93cb284 100644
--- a/pygments/lexer.py
+++ b/pygments/lexer.py
@@ -75,6 +75,8 @@ class Lexer(object):
Can also be ``'guess'`` to use a simple UTF-8 / Locale / Latin1
detection, or ``'chardet'`` to use the chardet library, if it is
installed.
+ ``inencoding``
+ Overrides the ``encoding`` if given.
"""
#: Name of the lexer
@@ -102,7 +104,7 @@ class Lexer(object):
self.ensurenl = get_bool_opt(options, 'ensurenl', True)
self.tabsize = get_int_opt(options, 'tabsize', 0)
self.encoding = options.get('encoding', 'latin1')
- # self.encoding = options.get('inencoding', None) or self.encoding
+ self.encoding = options.get('inencoding') or self.encoding
self.filters = []
for filter_ in get_list_opt(options, 'filters', ()):
self.add_filter(filter_)