2
0
mirror of https://github.com/koreader/koreader synced 2024-11-11 19:11:14 +00:00

escape quotes and other funny characters in word when popening sdcv

This commit is contained in:
chrox 2013-05-01 17:53:18 +08:00
parent 1a23787e26
commit 390135d02d

View File

@ -39,7 +39,8 @@ end
function ReaderDictionary:stardictLookup(word)
DEBUG("lookup word:", word)
if word then
local std_out = io.popen("./sdcv -nj "..'\"'..word..'\"', "r")
-- escape quotes and other funny characters in word
local std_out = io.popen("./sdcv -nj "..("%q"):format(word), "r")
local results_str = std_out:read("*all")
if results_str then
--DEBUG("result str:", word, results_str)