aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMunyoki Kilyungi2023-05-09 13:01:58 +0300
committerBonfaceKilz2023-05-26 08:40:22 +0300
commit767343f7b53079118d62507a9549a8b17b72cbbd (patch)
tree40463e143571e8e0a751743ae9db96725726612b
parent6a193980dd83c235962a9a2adc127daa001036e3 (diff)
downloadgn-transform-databases-767343f7b53079118d62507a9549a8b17b72cbbd.tar.gz
Replace chars not allowed in RDF
* dump.scm (sanitize-rdf-string): New function Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
-rwxr-xr-xdump.scm8
1 files changed, 8 insertions, 0 deletions
diff --git a/dump.scm b/dump.scm
index eca54cd..835a199 100755
--- a/dump.scm
+++ b/dump.scm
@@ -135,6 +135,14 @@ association list mapping substrings to their replacements."
str
replacement-alist))
+(define (sanitize-rdf-string str)
+ (replace-substrings
+ (string-trim-both str)
+ '(("\r" . "\\r")
+ ("\n" . "\\n")
+ ("\"" . "'")
+ ("\v" . ""))))
+
(define (snake->lower-camel str)
(let ((char-list (string->list str)))
(call-with-output-string