Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
82a69953
Commit
82a69953
authored
Jul 01, 2015
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed #101
parent
abd74170
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
+14
-2
src/json.hpp
src/json.hpp
+1
-1
src/json.hpp.re2c
src/json.hpp.re2c
+1
-1
test/unit.cpp
test/unit.cpp
+12
-0
No files found.
src/json.hpp
View file @
82a69953
...
...
@@ -3978,7 +3978,7 @@ class basic_json
{
// control characters (everything between 0x00 and 0x1f)
// -> create four-digit hex representation
o
<<
"
\\
u"
<<
std
::
hex
<<
std
::
setw
(
4
)
<<
std
::
setfill
(
'0'
)
<<
int
(
c
);
o
<<
"
\\
u"
<<
std
::
hex
<<
std
::
setw
(
4
)
<<
std
::
setfill
(
'0'
)
<<
int
(
c
)
<<
std
::
dec
;
}
else
{
...
...
src/json.hpp.re2c
View file @
82a69953
...
...
@@ -3978,7 +3978,7 @@ class basic_json
{
// control characters (everything between 0x00 and 0x1f)
// -> create four-digit hex representation
o << "\\u" << std::hex << std::setw(4) << std::setfill('0') << int(c);
o << "\\u" << std::hex << std::setw(4) << std::setfill('0') << int(c)
<< std::dec
;
}
else
{
...
...
test/unit.cpp
View file @
82a69953
...
...
@@ -9276,4 +9276,16 @@ TEST_CASE("regression tests")
// we need to cast to int to compile with Catch - the value is int32_t
CHECK
(
static_cast
<
int
>
(
j
[
"int_1"
])
==
1
);
}
SECTION
(
"issue #101 - binary string causes numbers to be dumped as hex"
)
{
int64_t
number
=
10
;
std
::
string
bytes
{
"
\x00
"
"asdf
\n
"
,
6
};
json
j
;
j
[
"int64"
]
=
number
;
j
[
"binary string"
]
=
bytes
;
// make sure the number is really printed as decimal "10" and not as
// hexadecimal "a"
CHECK
(
j
.
dump
()
==
"{
\"
binary string
\"
:
\"\\
u0000asdf
\\
n
\"
,
\"
int64
\"
:10}"
);
}
}
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