diff options
Diffstat (limited to 'pygments/formatters/bbcode.py')
-rw-r--r-- | pygments/formatters/bbcode.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pygments/formatters/bbcode.py b/pygments/formatters/bbcode.py index 0e9338bd..d9b96485 100644 --- a/pygments/formatters/bbcode.py +++ b/pygments/formatters/bbcode.py @@ -72,11 +72,13 @@ class BBCodeFormatter(Formatter): if self._mono: outfile.write('[font=monospace]') + enc = self.encoding lastval = '' lasttype = None for ttype, value in tokensource: - value = value.encode(self.encoding) + if enc: + value = value.encode(enc) while ttype not in self.styles: ttype = ttype.parent if ttype == lasttype: |