summaryrefslogtreecommitdiff
path: root/pygments/formatters/html.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/formatters/html.py
parent25ad3be9474211bb8a652deadea00677886dadf5 (diff)
downloadpygments-1d634b6950bfac268f6d05a673fd48094738f01e.tar.gz
[svn] Improve Unicode handling without encoding.
Diffstat (limited to 'pygments/formatters/html.py')
-rw-r--r--pygments/formatters/html.py5
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")