Try using backslash to escape newlines in SIL strings
thanks https://stackoverflow.com/a/54336425
This commit is contained in:
parent
b81c33cda8
commit
c94774fbb7
1 changed files with 4 additions and 0 deletions
|
@ -110,6 +110,10 @@ class Writer(Object):
|
||||||
# file. so must cleanup anything that would complicate that
|
# file. so must cleanup anything that would complicate that
|
||||||
value = value.replace('\r\n', '\n')
|
value = value.replace('\r\n', '\n')
|
||||||
|
|
||||||
|
# nb. also, if a string value does contain newlines, we must
|
||||||
|
# embed backslash to properly escape them
|
||||||
|
value = value.replace('\n', '\\\n')
|
||||||
|
|
||||||
value = value.replace("'", "''")
|
value = value.replace("'", "''")
|
||||||
return f"'{value}'"
|
return f"'{value}'"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue