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
cea24267
Commit
cea24267
authored
Mar 24, 2017
by
Ted Lyngmo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UTF8 encoding enhancement
parent
8a872927
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
src/json.hpp
src/json.hpp
+3
-3
src/json.hpp.re2c
src/json.hpp.re2c
+3
-3
No files found.
src/json.hpp
View file @
cea24267
...
...
@@ -10344,20 +10344,20 @@ class basic_json
else
if
(
codepoint
<=
0x7ff
)
{
// 2-byte characters: 110xxxxx 10xxxxxx
result
.
append
(
1
,
static_cast
<
typename
string_t
::
value_type
>
(
0xC0
|
(
(
codepoint
>>
6
)
&
0x1F
)));
result
.
append
(
1
,
static_cast
<
typename
string_t
::
value_type
>
(
0xC0
|
(
codepoint
>>
6
)));
result
.
append
(
1
,
static_cast
<
typename
string_t
::
value_type
>
(
0x80
|
(
codepoint
&
0x3F
)));
}
else
if
(
codepoint
<=
0xffff
)
{
// 3-byte characters: 1110xxxx 10xxxxxx 10xxxxxx
result
.
append
(
1
,
static_cast
<
typename
string_t
::
value_type
>
(
0xE0
|
(
(
codepoint
>>
12
)
&
0x0F
)));
result
.
append
(
1
,
static_cast
<
typename
string_t
::
value_type
>
(
0xE0
|
(
codepoint
>>
12
)));
result
.
append
(
1
,
static_cast
<
typename
string_t
::
value_type
>
(
0x80
|
((
codepoint
>>
6
)
&
0x3F
)));
result
.
append
(
1
,
static_cast
<
typename
string_t
::
value_type
>
(
0x80
|
(
codepoint
&
0x3F
)));
}
else
if
(
codepoint
<=
0x10ffff
)
{
// 4-byte characters: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
result
.
append
(
1
,
static_cast
<
typename
string_t
::
value_type
>
(
0xF0
|
(
(
codepoint
>>
18
)
&
0x07
)));
result
.
append
(
1
,
static_cast
<
typename
string_t
::
value_type
>
(
0xF0
|
(
codepoint
>>
18
)));
result
.
append
(
1
,
static_cast
<
typename
string_t
::
value_type
>
(
0x80
|
((
codepoint
>>
12
)
&
0x3F
)));
result
.
append
(
1
,
static_cast
<
typename
string_t
::
value_type
>
(
0x80
|
((
codepoint
>>
6
)
&
0x3F
)));
result
.
append
(
1
,
static_cast
<
typename
string_t
::
value_type
>
(
0x80
|
(
codepoint
&
0x3F
)));
...
...
src/json.hpp.re2c
View file @
cea24267
...
...
@@ -10344,20 +10344,20 @@ class basic_json
else if (codepoint <= 0x7ff)
{
// 2-byte characters: 110xxxxx 10xxxxxx
result.append(1, static_cast<typename string_t::value_type>(0xC0 | (
(codepoint >> 6) & 0x1F
)));
result.append(1, static_cast<typename string_t::value_type>(0xC0 | (
codepoint >> 6
)));
result.append(1, static_cast<typename string_t::value_type>(0x80 | (codepoint & 0x3F)));
}
else if (codepoint <= 0xffff)
{
// 3-byte characters: 1110xxxx 10xxxxxx 10xxxxxx
result.append(1, static_cast<typename string_t::value_type>(0xE0 | (
(codepoint >> 12) & 0x0F
)));
result.append(1, static_cast<typename string_t::value_type>(0xE0 | (
codepoint >> 12
)));
result.append(1, static_cast<typename string_t::value_type>(0x80 | ((codepoint >> 6) & 0x3F)));
result.append(1, static_cast<typename string_t::value_type>(0x80 | (codepoint & 0x3F)));
}
else if (codepoint <= 0x10ffff)
{
// 4-byte characters: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
result.append(1, static_cast<typename string_t::value_type>(0xF0 | (
(codepoint >> 18) & 0x07
)));
result.append(1, static_cast<typename string_t::value_type>(0xF0 | (
codepoint >> 18
)));
result.append(1, static_cast<typename string_t::value_type>(0x80 | ((codepoint >> 12) & 0x3F)));
result.append(1, static_cast<typename string_t::value_type>(0x80 | ((codepoint >> 6) & 0x3F)));
result.append(1, static_cast<typename string_t::value_type>(0x80 | (codepoint & 0x3F)));
...
...
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