From 390135d02d2472ed12c2ff0adce356bb3d8ded14 Mon Sep 17 00:00:00 2001 From: chrox Date: Wed, 1 May 2013 17:53:18 +0800 Subject: [PATCH] escape quotes and other funny characters in word when popening sdcv --- frontend/ui/reader/readerdictionary.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/ui/reader/readerdictionary.lua b/frontend/ui/reader/readerdictionary.lua index 81292417c..e6f719f21 100644 --- a/frontend/ui/reader/readerdictionary.lua +++ b/frontend/ui/reader/readerdictionary.lua @@ -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)