From f94820c824ea17afab9f3237411e28dde303d6ca Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Wed, 9 Apr 2014 08:34:43 +0200 Subject: [PATCH] Fixing JSON encoding code to include among other TAB (%T <-> \t) --- library/kernel/json_string.e | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/library/kernel/json_string.e b/library/kernel/json_string.e index a692219d..4cc190ee 100644 --- a/library/kernel/json_string.e +++ b/library/kernel/json_string.e @@ -82,12 +82,21 @@ feature -- Access when '%"' then Result.append_character ('%"') i := i + 2 + when 'b' then + Result.append_character ('%B') + i := i + 2 + when 'f' then + Result.append_character ('%F') + i := i + 2 when 'n' then Result.append_character ('%N') i := i + 2 when 'r' then Result.append_character ('%R') i := i + 2 + when 't' then + Result.append_character ('%T') + i := i + 2 when 'u' then --| Leave Unicode \uXXXX unescaped Result.append_character ('\') @@ -129,12 +138,21 @@ feature -- Access when '%"' then Result.append_character ('%"') i := i + 2 + when 'b' then + Result.append_character ('%B') + i := i + 2 + when 'f' then + Result.append_character ('%F') + i := i + 2 when 'n' then Result.append_character ('%N') i := i + 2 when 'r' then Result.append_character ('%R') i := i + 2 + when 'T' then + Result.append_character ('%T') + i := i + 2 when 'u' then hex := s.substring (i+2, i+2+4 - 1) if hex.count = 4 then @@ -264,8 +282,11 @@ feature {NONE} -- Implementation inspect c when '%"' then Result.append_string ("\%"") when '\' then Result.append_string ("\\") - when '%R' then Result.append_string ("\r") + when '%B' then Result.append_string ("\b") + when '%F' then Result.append_string ("\f") when '%N' then Result.append_string ("\n") + when '%R' then Result.append_string ("\r") + when '%T' then Result.append_string ("\t") else Result.extend (c) end @@ -292,8 +313,11 @@ feature {NONE} -- Implementation inspect c when '%"' then Result.append_string ("\%"") when '\' then Result.append_string ("\\") - when '%R' then Result.append_string ("\r") + when '%B' then Result.append_string ("\b") + when '%F' then Result.append_string ("\f") when '%N' then Result.append_string ("\n") + when '%R' then Result.append_string ("\r") + when '%T' then Result.append_string ("\t") else Result.extend (c) end