Browse Source

Fix unicode escape sequence formatting

pull/4/head
--nn 7 years ago
committed by GitHub
parent
commit
2746cc671d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      RenX.ServerList/RenX_ServerList.cpp

4
RenX.ServerList/RenX_ServerList.cpp

@ -52,7 +52,7 @@ Jupiter::String jsonify(const Jupiter::ReadableString &in_str)
result += '\"'; result += '\"';
} }
else if (*ptr < 0x20) // control characters else if (*ptr < 0x20) // control characters
result.aformat("\\u00%x", *ptr); result.aformat("\\u%04x", *ptr);
else if ((*ptr & 0x80) != 0) // UTF-8 sequence; copy to bypass above processing else if ((*ptr & 0x80) != 0) // UTF-8 sequence; copy to bypass above processing
{ {
result += *ptr; result += *ptr;
@ -105,7 +105,7 @@ Jupiter::String sanitize_game(const Jupiter::ReadableString &in_str)
result += '\"'; result += '\"';
} }
else if (*ptr < 0x20) // control characters else if (*ptr < 0x20) // control characters
result.aformat("\\u00%x", *ptr); result.aformat("\\u%04x", *ptr);
else if (*ptr == '~') // Game server list control character else if (*ptr == '~') // Game server list control character
result += "\\u007E"_jrs; result += "\\u007E"_jrs;
else if (*ptr == ';') // Game server list control character else if (*ptr == ';') // Game server list control character

Loading…
Cancel
Save