summaryrefslogtreecommitdiff
path: root/pygments/lexer.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-11-06 13:18:19 +0100
committerGeorg Brandl <georg@python.org>2014-11-06 13:18:19 +0100
commit69e83eb0856666d2594c96b1e8fae42dbeb92318 (patch)
tree818573e86d101542b1f7536c313443d5baf77dd5 /pygments/lexer.py
parent9053d1b7a1c3ac2c90944fe9d9564e0351dac74f (diff)
downloadpygments-69e83eb0856666d2594c96b1e8fae42dbeb92318.tar.gz
Default lexer encoding is now "guess", i.e. UTF-8 / Locale / Latin1 is
tried in that order.
Diffstat (limited to 'pygments/lexer.py')
-rw-r--r--pygments/lexer.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/pygments/lexer.py b/pygments/lexer.py
index 687d19e3..e6c60015 100644
--- a/pygments/lexer.py
+++ b/pygments/lexer.py
@@ -71,10 +71,9 @@ class Lexer(object):
``encoding``
If given, must be an encoding name. This encoding will be used to
convert the input string to Unicode, if it is not already a Unicode
- string (default: ``'latin1'``).
- Can also be ``'guess'`` to use a simple UTF-8 / Locale / Latin1
- detection, or ``'chardet'`` to use the chardet library, if it is
- installed.
+ string (default: ``'guess'``, which uses a simple UTF-8 / Locale /
+ Latin1 detection. Can also be ``'chardet'`` to use the chardet
+ library, if it is installed.
``inencoding``
Overrides the ``encoding`` if given.
"""
@@ -103,7 +102,7 @@ class Lexer(object):
self.stripall = get_bool_opt(options, 'stripall', False)
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('encoding', 'guess')
self.encoding = options.get('inencoding') or self.encoding
self.filters = []
for filter_ in get_list_opt(options, 'filters', ()):