diff options
author | gbrandl <devnull@localhost> | 2006-12-20 21:14:44 +0100 |
---|---|---|
committer | gbrandl <devnull@localhost> | 2006-12-20 21:14:44 +0100 |
commit | 1d634b6950bfac268f6d05a673fd48094738f01e (patch) | |
tree | 2788e9f4315a10392eee6371860c6045f8f74e31 /pygments/formatters/html.py | |
parent | 25ad3be9474211bb8a652deadea00677886dadf5 (diff) | |
download | pygments-1d634b6950bfac268f6d05a673fd48094738f01e.tar.gz |
[svn] Improve Unicode handling without encoding.
Diffstat (limited to 'pygments/formatters/html.py')
-rw-r--r-- | pygments/formatters/html.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pygments/formatters/html.py b/pygments/formatters/html.py index 3a5bafb1..f72046ef 100644 --- a/pygments/formatters/html.py +++ b/pygments/formatters/html.py @@ -226,6 +226,7 @@ class HtmlFormatter(Formatter): def _format_nowrap(self, tokensource, outfile, lnos=False): lncount = 0 nocls = self.noclasses + enc = self.encoding # for <span style=""> lookup only getcls = self.ttype2class.get c2s = self.class2style @@ -233,7 +234,9 @@ class HtmlFormatter(Formatter): write = outfile.write lspan = '' for ttype, value in tokensource: - htmlvalue = escape_html(value.encode(self.encoding)) + if enc: + value = value.encode(enc) + htmlvalue = escape_html(value) if lnos: lncount += value.count("\n") |