summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbringert <bringert@cs.chalmers.se>2006-02-01 10:24:37 +0000
committerbringert <bringert@cs.chalmers.se>2006-02-01 10:24:37 +0000
commit992e212bccec9f30ee7b4f5e764b0bd793ccc651 (patch)
tree80096d60cbb025a9fcf11132ab553f223c151182
parent36492443e970de022b7dd5ddbe463616bb6c56e4 (diff)
Escape backslashes and double quotes in SRGS attribute values.
-rw-r--r--src/GF/Speech/PrSRGS.hs7
1 files 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]