Skip to content

Commit c0292fb

Browse files
committed
Update JSONX
1 parent c003514 commit c0292fb

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

deps/jsonx.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Copied from:
2-
# https://github.com/JuliaIO/JSON.jl/tree/52d8b907fd26c02a13f6d6f807524e71859cc5bb/vendor
2+
# https://github.com/JuliaIO/JSON.jl/tree/b2787c38d18aa5a6828eefabc8d4f4726e1c09e7/vendor
33

44

55
module JSONX
@@ -142,10 +142,14 @@ function unescape_string(str::String, start_pos::Int, end_pos::Int)
142142
b == 0x00 && throw(ArgumentError("Invalid escape sequence \\$(Char(esc_c))"))
143143
print(io, Char(b))
144144
end
145+
146+
pos += 1
145147
else
146-
print(io, Char(c))
148+
# Regular character
149+
print(io, str[pos])
150+
pos = nextind(str, pos)
147151
end
148-
pos += 1
152+
149153
end
150154
return String(take!(io))
151155
end

test/jsonx.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Copied from:
2-
# https://github.com/JuliaIO/JSON.jl/tree/52d8b907fd26c02a13f6d6f807524e71859cc5bb/vendor
2+
# https://github.com/JuliaIO/JSON.jl/tree/b2787c38d18aa5a6828eefabc8d4f4726e1c09e7/vendor
33

44
# Tests for JSONX module
55
using Test
@@ -267,6 +267,8 @@ import IJulia: JSONX
267267
@test JSONX.parse("\"\\uD83C\\uDF55\"") == "🍕" # Pizza emoji
268268
# Mixed content
269269
@test JSONX.parse("\"Hello \\u0041\\u006E\\u0064\\u0072\\u0065\\u0077!\"") == "Hello Andrew!"
270+
# String unescaping
271+
@test JSONX.parse(raw"\"𝔸\\a\"") == "𝔸\\a"
270272
# Writing Unicode
271273
@test JSONX.json("A") == "\"A\""
272274
@test JSONX.json("😀") == "\"😀\""

0 commit comments

Comments
 (0)