diff options
author | gbrandl <devnull@localhost> | 2009-03-31 10:26:55 -0500 |
---|---|---|
committer | gbrandl <devnull@localhost> | 2009-03-31 10:26:55 -0500 |
commit | 7b95efab48d9ec79e995bf4d6db10fd049e3395a (patch) | |
tree | 48fc9b840dab83976a85af85d1c705dbaa051a0b /pygments/formatter.py | |
parent | f12c878ed096137c91658a0f62f0070e08c2afea (diff) | |
download | pygments-7b95efab48d9ec79e995bf4d6db10fd049e3395a.tar.gz |
Port Pygments to Python 3.1.
Diffstat (limited to 'pygments/formatter.py')
-rw-r--r-- | pygments/formatter.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/pygments/formatter.py b/pygments/formatter.py index a577a4e3..d6c75a01 100644 --- a/pygments/formatter.py +++ b/pygments/formatter.py @@ -9,6 +9,8 @@ :license: BSD, see LICENSE for details. """ +import codecs + from pygments.util import get_bool_opt from pygments.styles import get_style_by_name @@ -84,4 +86,7 @@ class Formatter(object): Format ``tokensource``, an iterable of ``(tokentype, tokenstring)`` tuples and write it into ``outfile``. """ - raise NotImplementedError() + if self.encoding: + # wrap the outfile in a StreamWriter + outfile = codecs.lookup(self.encoding)[3](outfile) + return self.format_unencoded(tokensource, outfile) |