ThirdParty/Pygments/pygments/formatter.py

changeset 4172
4f20dba37ab6
parent 3145
a9de05d4a22f
child 4697
c2e9bf425554
--- a/ThirdParty/Pygments/pygments/formatter.py	Wed Mar 11 18:25:37 2015 +0100
+++ b/ThirdParty/Pygments/pygments/formatter.py	Wed Mar 11 18:32:27 2015 +0100
@@ -5,27 +5,20 @@
 
     Base formatter class.
 
-    :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
+    :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
     :license: BSD, see LICENSE for details.
 """
 
-from __future__ import unicode_literals
-
-try:
-    basestring    # __IGNORE_WARNING__
-except NameError:
-    basestring = str
-
 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
 
@@ -75,7 +68,10 @@
         self.full  = get_bool_opt(options, 'full', False)
         self.title = options.get('title', '')
         self.encoding = options.get('encoding', None) or None
-        self.encoding = options.get('outencoding', None) or self.encoding
+        if self.encoding in ('guess', 'chardet'):
+            # can happen for e.g. pygmentize -O encoding=guess
+            self.encoding = 'utf-8'
+        self.encoding = options.get('outencoding') or self.encoding
         self.options = options
 
     def get_style_defs(self, arg=''):

eric ide

mercurial