diff options
Diffstat (limited to 'pygments/formatters/terminal.py')
-rw-r--r-- | pygments/formatters/terminal.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pygments/formatters/terminal.py b/pygments/formatters/terminal.py index b0a134b8..375e9cd1 100644 --- a/pygments/formatters/terminal.py +++ b/pygments/formatters/terminal.py @@ -73,8 +73,10 @@ class TerminalFormatter(Formatter): self.colorscheme = options.get('colorscheme', None) or TERMINAL_COLORS def format(self, tokensource, outfile): + enc = self.encoding for ttype, value in tokensource: - value = value.encode(self.encoding) + if enc: + value = value.encode(enc) color = self.colorscheme.get(ttype) while color is None: ttype = ttype[:-1] |