mirror of
https://github.com/nlohmann/json.git
synced 2025-07-12 09:21:42 +03:00
fixes #270
This commit is contained in:
@ -5957,18 +5957,15 @@ class basic_json
|
||||
{
|
||||
// convert a number 0..15 to its hex representation
|
||||
// (0..f)
|
||||
const auto hexify = [](const int v) -> char
|
||||
static const char hexify[16] =
|
||||
{
|
||||
static const char hex[16] = { '0', '1', '2', '3',
|
||||
'4', '5', '6', '7',
|
||||
'8', '9', 'a', 'b',
|
||||
'c', 'd', 'e', 'f' };
|
||||
return hex[v];
|
||||
'0', '1', '2', '3', '4', '5', '6', '7',
|
||||
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
|
||||
};
|
||||
|
||||
// print character c as \uxxxx
|
||||
for (const char m :
|
||||
{ 'u', '0', '0', hexify(c >> 4), hexify(c & 0x0f)
|
||||
{ 'u', '0', '0', hexify[c >> 4], hexify[c & 0x0f]
|
||||
})
|
||||
{
|
||||
result[++pos] = m;
|
||||
|
Reference in New Issue
Block a user