Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
json
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
json
Commits
c0132232
Commit
c0132232
authored
Nov 14, 2015
by
Niels
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #146 from robertmrk/surrogate-pair-parsing-fix
Fix character skipping after a surrogate pair
parents
39486303
ec7a1d83
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
4 deletions
+9
-4
json.hpp
src/json.hpp
+2
-2
json.hpp.re2c
src/json.hpp.re2c
+2
-2
unit.cpp
test/unit.cpp
+5
-0
No files found.
src/json.hpp
View file @
c0132232
...
...
@@ -6856,8 +6856,8 @@ basic_json_parser_59:
auto
codepoint2
=
std
::
strtoul
(
std
::
string
(
reinterpret_cast
<
typename
string_t
::
const_pointer
>
(
i
+
7
),
4
).
c_str
(),
nullptr
,
16
);
result
+=
to_unicode
(
codepoint
,
codepoint2
);
// skip the next 1
1
characters (xxxx\uyyyy)
i
+=
1
1
;
// skip the next 1
0
characters (xxxx\uyyyy)
i
+=
1
0
;
}
else
{
...
...
src/json.hpp.re2c
View file @
c0132232
...
...
@@ -6162,8 +6162,8 @@ class basic_json
auto codepoint2 = std::strtoul(std::string(reinterpret_cast<typename string_t::const_pointer>
(i + 7), 4).c_str(), nullptr, 16);
result += to_unicode(codepoint, codepoint2);
// skip the next 1
1
characters (xxxx\uyyyy)
i += 1
1
;
// skip the next 1
0
characters (xxxx\uyyyy)
i += 1
0
;
}
else
{
...
...
test/unit.cpp
View file @
c0132232
...
...
@@ -10205,4 +10205,9 @@ TEST_CASE("regression tests")
j
[
"string"
]
=
bytes
;
CHECK
(
j
[
"string"
]
==
"\u0007\u0007"
);
}
SECTION
(
"character following a surrogate pair is skipped"
)
{
CHECK
(
json
::
parse
(
"
\"\\
ud80c
\\
udc60abc
\"
"
).
get
<
json
::
string_t
>
()
==
u8"\U00013060abc"
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment