File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
core/src/main/python/wlsdeploy/json Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -248,8 +248,7 @@ def _format_json_value(value):
248
248
249
249
def _escape_text (text ):
250
250
"""
251
- Escape the specified text for use in a double-quoted string.
252
- Escape embedded double quotes with a backslash.
251
+ Escape the specified text for use in a double-quoted string to become valid json expression.
253
252
:param text: the text to escape
254
253
:return: the escaped text
255
254
"""
@@ -259,4 +258,16 @@ def _escape_text(text):
259
258
result = text .replace ('\\ ' , '\\ \\ ' )
260
259
if '"' in text :
261
260
result = text .replace ('"' , '\\ "' )
261
+ if '\n ' in text :
262
+ result = text .replace ("\n " , "\\ \\ n" )
263
+ if '\b ' in text :
264
+ result = text .replace ("\b " , "\\ \\ b" )
265
+ if '\f ' in text :
266
+ result = text .replace ("\f " , "\\ \\ f" )
267
+ if '\r ' in text :
268
+ result = text .replace ("\r " , "\\ \\ r" )
269
+ if '\t ' in text :
270
+ result = text .replace ("\t " , "\\ \\ t" )
271
+ if '\/' in text :
272
+ result = text .replace ("\/" , "\\ \\ /" )
262
273
return result
You can’t perform that action at this time.
0 commit comments