Skip to content

Commit 8bcc2aa

Browse files
committed
RFC requires subset of control characters to be escaped
Section 7 of the RFC only requires bytes 00 (NUL) to 1F (US) to be escaped. Signed-off-by: onox <[email protected]>
1 parent cdd86a1 commit 8bcc2aa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/json-tokenizers.adb

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
-- See the License for the specific language governing permissions and
1313
-- limitations under the License.
1414

15-
with Ada.Characters.Handling;
1615
with Ada.Characters.Latin_1;
1716
with Ada.IO_Exceptions;
1817
with Ada.Strings.Bounded;
@@ -28,6 +27,7 @@ package body JSON.Tokenizers is
2827
Escaped : Boolean := False;
2928

3029
use type Streams.AS.Stream_Element_Offset;
30+
use Ada.Characters.Latin_1;
3131
begin
3232
loop
3333
C := Stream.Read_Character (Index);
@@ -49,7 +49,7 @@ package body JSON.Tokenizers is
4949
end case;
5050
elsif C /= '\' then
5151
-- Check C is not a control character
52-
if Ada.Characters.Handling.Is_Control (C) then
52+
if C in NUL .. US then
5353
raise Tokenizer_Error with "Unexpected control character in string";
5454
end if;
5555
end if;

0 commit comments

Comments
 (0)