summaryrefslogtreecommitdiff
path: root/pygments/formatter.py
diff options
context:
space:
mode:
authorgbrandl <devnull@localhost>2006-12-20 21:14:44 +0100
committergbrandl <devnull@localhost>2006-12-20 21:14:44 +0100
commit1d634b6950bfac268f6d05a673fd48094738f01e (patch)
tree2788e9f4315a10392eee6371860c6045f8f74e31 /pygments/formatter.py
parent25ad3be9474211bb8a652deadea00677886dadf5 (diff)
downloadpygments-1d634b6950bfac268f6d05a673fd48094738f01e.tar.gz
[svn] Improve Unicode handling without encoding.
Diffstat (limited to 'pygments/formatter.py')
-rw-r--r--pygments/formatter.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/pygments/formatter.py b/pygments/formatter.py
index c750f0d8..41959565 100644
--- a/pygments/formatter.py
+++ b/pygments/formatter.py
@@ -41,14 +41,20 @@ class Formatter(object):
``encoding``
If given, must be an encoding name. This will be used to
convert the Unicode token strings to byte strings in the
- output (default: 'latin1').
+ output. If it is "" or None, Unicode strings will be written
+ to the output file, which most file-like objects do not
+ support (default: None).
"""
+ #: If True, this formatter outputs Unicode strings when no encoding
+ #: option is given.
+ unicodeoutput = True
+
def __init__(self, **options):
self.style = _lookup_style(options.get('style', 'default'))
self.full = get_bool_opt(options, 'full', False)
self.title = options.get('title', '')
- self.encoding = options.get('encoding', 'latin1')
+ self.encoding = options.get('encoding', None) or None
self.options = options
def get_style_defs(self, arg=''):