Skip to content

Commit f94820c

Browse files
committed
Fixing JSON encoding code to include among other TAB (%T <-> \t)
1 parent cb7c20a commit f94820c

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

library/kernel/json_string.e

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,21 @@ feature -- Access
8282
when '%"' then
8383
Result.append_character ('%"')
8484
i := i + 2
85+
when 'b' then
86+
Result.append_character ('%B')
87+
i := i + 2
88+
when 'f' then
89+
Result.append_character ('%F')
90+
i := i + 2
8591
when 'n' then
8692
Result.append_character ('%N')
8793
i := i + 2
8894
when 'r' then
8995
Result.append_character ('%R')
9096
i := i + 2
97+
when 't' then
98+
Result.append_character ('%T')
99+
i := i + 2
91100
when 'u' then
92101
--| Leave Unicode \uXXXX unescaped
93102
Result.append_character ('\')
@@ -129,12 +138,21 @@ feature -- Access
129138
when '%"' then
130139
Result.append_character ('%"')
131140
i := i + 2
141+
when 'b' then
142+
Result.append_character ('%B')
143+
i := i + 2
144+
when 'f' then
145+
Result.append_character ('%F')
146+
i := i + 2
132147
when 'n' then
133148
Result.append_character ('%N')
134149
i := i + 2
135150
when 'r' then
136151
Result.append_character ('%R')
137152
i := i + 2
153+
when 'T' then
154+
Result.append_character ('%T')
155+
i := i + 2
138156
when 'u' then
139157
hex := s.substring (i+2, i+2+4 - 1)
140158
if hex.count = 4 then
@@ -264,8 +282,11 @@ feature {NONE} -- Implementation
264282
inspect c
265283
when '%"' then Result.append_string ("\%"")
266284
when '\' then Result.append_string ("\\")
267-
when '%R' then Result.append_string ("\r")
285+
when '%B' then Result.append_string ("\b")
286+
when '%F' then Result.append_string ("\f")
268287
when '%N' then Result.append_string ("\n")
288+
when '%R' then Result.append_string ("\r")
289+
when '%T' then Result.append_string ("\t")
269290
else
270291
Result.extend (c)
271292
end
@@ -292,8 +313,11 @@ feature {NONE} -- Implementation
292313
inspect c
293314
when '%"' then Result.append_string ("\%"")
294315
when '\' then Result.append_string ("\\")
295-
when '%R' then Result.append_string ("\r")
316+
when '%B' then Result.append_string ("\b")
317+
when '%F' then Result.append_string ("\f")
296318
when '%N' then Result.append_string ("\n")
319+
when '%R' then Result.append_string ("\r")
320+
when '%T' then Result.append_string ("\t")
297321
else
298322
Result.extend (c)
299323
end

0 commit comments

Comments
 (0)