summaryrefslogtreecommitdiff
path: root/pygments/formatters/latex.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/latex.py
parent25ad3be9474211bb8a652deadea00677886dadf5 (diff)
downloadpygments-1d634b6950bfac268f6d05a673fd48094738f01e.tar.gz
[svn] Improve Unicode handling without encoding.
Diffstat (limited to 'pygments/formatters/latex.py')
-rw-r--r--pygments/formatters/latex.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/pygments/formatters/latex.py b/pygments/formatters/latex.py
index 305bb174..d3d4f0b5 100644
--- a/pygments/formatters/latex.py
+++ b/pygments/formatters/latex.py
@@ -149,6 +149,7 @@ class LatexFormatter(Formatter):
def format(self, tokensource, outfile):
# TODO: add support for background colors
+ enc = self.encoding
if self.full:
realoutfile = outfile
@@ -165,7 +166,9 @@ class LatexFormatter(Formatter):
outfile.write(']\n')
for ttype, value in tokensource:
- value = escape_tex(value.encode(self.encoding))
+ if enc:
+ value = value.encode(enc)
+ value = escape_tex(value)
cmd = self.ttype2cmd.get(ttype)
while cmd is None:
ttype = ttype.parent