From b7f64b384b5523545bc5b90bc700cb7a97ad7586 Mon Sep 17 00:00:00 2001 From: bringert Date: Wed, 1 Feb 2006 10:24:37 +0000 Subject: [PATCH] Escape backslashes and double quotes in SRGS attribute values. --- src/GF/Speech/PrSRGS.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/GF/Speech/PrSRGS.hs b/src/GF/Speech/PrSRGS.hs index 4044f097f..63775c852 100644 --- a/src/GF/Speech/PrSRGS.hs +++ b/src/GF/Speech/PrSRGS.hs @@ -105,6 +105,9 @@ showsAttrs = concatS . map (showChar ' ' .) . map showsAttr showsAttr :: Attr -> ShowS showsAttr (n,v) = showString n . showString "=\"" . showString (escape v) . showString "\"" --- FIXME: escape double quotes +-- FIXME: escape strange charachters with &#xxx; escape :: String -> String -escape = id \ No newline at end of file +escape = concatMap escChar + where + escChar c | c `elem` ['"','\\'] = '\\':[c] + | otherwise = [c]