Skip to content

Commit

Permalink
character u007f is not mentioned in RFC 4627
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 17, 2014
1 parent 9d8e446 commit cd15595
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Mojo/JSON.pm
Expand Up @@ -28,7 +28,7 @@ my %ESCAPE = (
'u2029' => "\x{2029}"
);
my %REVERSE = map { $ESCAPE{$_} => "\\$_" } keys %ESCAPE;
for (0x00 .. 0x1f, 0x7f) { $REVERSE{pack 'C', $_} //= sprintf '\u%.4X', $_ }
for (0x00 .. 0x1f) { $REVERSE{pack 'C', $_} //= sprintf '\u%.4X', $_ }

# Unicode encoding detection
my $UTF_PATTERNS = {
Expand Down Expand Up @@ -259,7 +259,7 @@ sub _encode_object {

sub _encode_string {
my $str = shift;
$str =~ s!([\x00-\x1f\x7f\x{2028}\x{2029}\\"/\b\f\n\r\t])!$REVERSE{$1}!gs;
$str =~ s!([\x00-\x1f\x{2028}\x{2029}\\"/\b\f\n\r\t])!$REVERSE{$1}!gs;
return "\"$str\"";
}

Expand Down

0 comments on commit cd15595

Please sign in to comment.