From a0449542244e01fe0974f3d5ad5db74931bba9f0 Mon Sep 17 00:00:00 2001 From: Reuh Date: Sun, 12 Mar 2017 13:23:27 +0100 Subject: [PATCH] Force UTF-8 when sending stuff to Pygmentsq --- vrel.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vrel.lua b/vrel.lua index 0c17c18..4b6fdac 100644 --- a/vrel.lua +++ b/vrel.lua @@ -208,7 +208,7 @@ local pygmentsStyle, extraStyle = config.pygmentsStyle or "monokai", config.extr local function highlight(paste, forceLexer) -- Syntax highlighting; should returns the style CSS code and code block HTML local source = assert(io.open("pygmentize.tmp", "w")) -- Lua can't at the same time write an read from a command, so we need to put one in a file source:write(paste.data) source:close() - local pygments = assert(io.popen("pygmentize -f html -O linenos=table,style="..pygmentsStyle.." -l "..(forceLexer or paste.syntax or "text").." pygmentize.tmp", "r")) + local pygments = assert(io.popen("pygmentize -P encoding=utf-8 -f html -O linenos=table,style="..pygmentsStyle.." -l "..(forceLexer or paste.syntax or "text").." pygmentize.tmp", "r")) local out = assert(pygments:read("*a")) pygments:close() if #out > 0 then -- if pygments available and available lexer (returned something) local style = assert(io.popen("pygmentize -f html -S "..pygmentsStyle, "r")) -- get style data