1. Georg Brandl
  2. pygments-main
Issue #835 resolved

Non-ascii characters in Python interactive session ouput get the the "err" class

Alex Marandon
created an issue

Hey, here is a little oddity I came across with Python highlighting:

>>> print "Éléphant"
Éléphant # non-ascii characters get the "err" CSS class
>>> import pygments
>>> pygments.__version__
'1.5'
>>> from pygments.lexers import PythonLexer
>>> from pygments.formatters import HtmlFormatter
>>> from pygments import highlight
>>> s = u"""
... >>> print "Éléphant"
... Éléphant
... """
>>> s
u'\n>>> print "\xc9l\xe9phant"\n\xc9l\xe9phant\n'
>>> highlight(s, PythonLexer(), HtmlFormatter())
u'<div class="highlight"><pre><span class="o">&gt;&gt;&gt;</span> <span class="k">print</span> <span class="s">&quot;\xc9l\xe9phant&quot;</span>\n<span class="err">\xc9</span><span class="n">l</span><span class="err">\xe9</span><span class="n">phant</span>\n</pre></div>\n'

The issue is visible on this message (which is awesome by the way, few libraries can demo themselves automatically in their bug tracker ;)

Comments (4)

  1. Log in to comment