#include "ddcConfig.h"
#include "utf8xx.h"
#include <stdio.h>
#include <string>
Go to the source code of this file.
std::string escapeCString | ( | const std::string & | s | ) |
Encode C escapes into string; encodes byte-wise with escapes
References Format().
std::string unescapeCString | ( | const std::string & | s | ) |
Decode C escapes in string. Also supports json-style "\uXXXX" utf8-escapes
std::string escapeJsonString | ( | const std::string & | s, | |
bool | assume_utf8 = true , |
|||
bool | add_quotes = false | |||
) |
Encode JSON escapes into string.
assume_utf8
is true (default), leaves bytes with high-bit set alone; otherwise encodes them as escapes. add_quotes
is true, the returned string will be wrapped in JSON-friendly double quotes ("") References Format().
Referenced by jsonStr().
std::string unescapeJsonString | ( | const std::string & | s | ) |
Decode all JSON escapes from a string.
std::string jsonStr | ( | const std::string & | s, | |
bool | assume_utf8 = true , |
|||
bool | add_quotes = true | |||
) | [inline] |
wrapper for escapeJsonString
References escapeJsonString().
Referenced by CConcHolder::BuildJsonContextString(), CConcHolder::GenerateOneHitStringJson(), and CConcXml::GetFreeHeaderBiblAttributesJson().
std::string unescapeUtf8String | ( | const std::string & | s | ) |
Decode escapes from a string to UTF-8