mirror of
https://git.zx2c4.com/cgit
synced 2025-06-24 18:58:39 +02:00
Fix UTF-8 with syntax-highlighting.py
Previously the script tried to encode output from Pygments with the ASCII codec, which failed. Signed-off-by: Přemysl Janouch <p.janouch@gmail.com>
This commit is contained in:
parent
4f6fb32f58
commit
b6da53dd75
1 changed files with 1 additions and 0 deletions
|
@ -25,6 +25,7 @@ from pygments import highlight
|
||||||
from pygments.formatters import HtmlFormatter
|
from pygments.formatters import HtmlFormatter
|
||||||
|
|
||||||
sys.stdin = codecs.getreader("utf-8")(sys.stdin.detach())
|
sys.stdin = codecs.getreader("utf-8")(sys.stdin.detach())
|
||||||
|
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
|
||||||
doc = sys.stdin.read()
|
doc = sys.stdin.read()
|
||||||
try:
|
try:
|
||||||
lexer = get_lexer_for_filename(sys.argv[1])
|
lexer = get_lexer_for_filename(sys.argv[1])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue