diff options
author | Tim Hatch <tim@timhatch.com> | 2014-04-23 16:48:10 -0400 |
---|---|---|
committer | Tim Hatch <tim@timhatch.com> | 2014-04-23 16:48:10 -0400 |
commit | 690a2bdfa924f76fd374e25bd9772c2090cf6414 (patch) | |
tree | 576991298817f1055da24857df6982dc2bd37d5a /pygments/formatter.py | |
parent | 1d9f7f4f19c49a22ecd119f58580f9bc5ccd5080 (diff) | |
parent | b69477dc22e228cde4c1d39bf11b292b88d95fe1 (diff) | |
download | pygments-690a2bdfa924f76fd374e25bd9772c2090cf6414.tar.gz |
Merged in lefticus/pygments-main (pull request #24)
Conflicts:
pygments/lexers/_mapping.py
pygments/lexers/agile.py
Diffstat (limited to 'pygments/formatter.py')
-rw-r--r-- | pygments/formatter.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/pygments/formatter.py b/pygments/formatter.py index 6eea3d75..b16ffee8 100644 --- a/pygments/formatter.py +++ b/pygments/formatter.py @@ -5,20 +5,20 @@ Base formatter class. - :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import codecs -from pygments.util import get_bool_opt +from pygments.util import get_bool_opt, string_types from pygments.styles import get_style_by_name __all__ = ['Formatter'] def _lookup_style(style): - if isinstance(style, basestring): + if isinstance(style, string_types): return get_style_by_name(style) return style @@ -68,6 +68,9 @@ class Formatter(object): self.full = get_bool_opt(options, 'full', False) self.title = options.get('title', '') self.encoding = options.get('encoding', None) or None + if self.encoding == 'guess': + # can happen for pygmentize -O encoding=guess + self.encoding = 'utf-8' self.encoding = options.get('outencoding', None) or self.encoding self.options = options |