Fixing JSON encoding code to include among other TAB (%T <-> \t)

This commit is contained in:
2014-04-09 08:34:43 +02:00
parent cb7c20a0b7
commit f94820c824

View File

@@ -82,12 +82,21 @@ feature -- Access
when '%"' then when '%"' then
Result.append_character ('%"') Result.append_character ('%"')
i := i + 2 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 when 'n' then
Result.append_character ('%N') Result.append_character ('%N')
i := i + 2 i := i + 2
when 'r' then when 'r' then
Result.append_character ('%R') Result.append_character ('%R')
i := i + 2 i := i + 2
when 't' then
Result.append_character ('%T')
i := i + 2
when 'u' then when 'u' then
--| Leave Unicode \uXXXX unescaped --| Leave Unicode \uXXXX unescaped
Result.append_character ('\') Result.append_character ('\')
@@ -129,12 +138,21 @@ feature -- Access
when '%"' then when '%"' then
Result.append_character ('%"') Result.append_character ('%"')
i := i + 2 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 when 'n' then
Result.append_character ('%N') Result.append_character ('%N')
i := i + 2 i := i + 2
when 'r' then when 'r' then
Result.append_character ('%R') Result.append_character ('%R')
i := i + 2 i := i + 2
when 'T' then
Result.append_character ('%T')
i := i + 2
when 'u' then when 'u' then
hex := s.substring (i+2, i+2+4 - 1) hex := s.substring (i+2, i+2+4 - 1)
if hex.count = 4 then if hex.count = 4 then
@@ -264,8 +282,11 @@ feature {NONE} -- Implementation
inspect c inspect c
when '%"' then Result.append_string ("\%"") when '%"' then Result.append_string ("\%"")
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 '%N' then Result.append_string ("\n")
when '%R' then Result.append_string ("\r")
when '%T' then Result.append_string ("\t")
else else
Result.extend (c) Result.extend (c)
end end
@@ -292,8 +313,11 @@ feature {NONE} -- Implementation
inspect c inspect c
when '%"' then Result.append_string ("\%"") when '%"' then Result.append_string ("\%"")
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 '%N' then Result.append_string ("\n")
when '%R' then Result.append_string ("\r")
when '%T' then Result.append_string ("\t")
else else
Result.extend (c) Result.extend (c)
end end