Add more unicode APIs
This commit is contained in:
@@ -112,6 +112,23 @@ namespace ANSCENTER {
|
||||
// Input: ASCII string with \uXXXX escapes (e.g., "\\u6c5f\\u6771 599")
|
||||
// Output: UTF-8 encoded Unicode string.
|
||||
static std::string ConvertUnicodeEscapesToUTF8(const std::string& escapedStr);
|
||||
|
||||
// Convert a UTF-8 string to Unicode escape sequences (\uXXXX).
|
||||
// ASCII chars (0x20-0x7E) are preserved, all others become \uXXXX.
|
||||
// Useful for encoding Unicode text into JSON-safe ASCII.
|
||||
static std::string ConvertUTF8ToUnicodeEscapes(const std::string& utf8Str);
|
||||
|
||||
// Double-escape \uXXXX sequences: \u1ee7 becomes \\u1ee7.
|
||||
// Useful when the string will be embedded in JSON and the literal \uXXXX must survive parsing.
|
||||
static std::string DoubleEscapeUnicode(const std::string& str);
|
||||
|
||||
// Convert UTF-8 to double-escaped Unicode: "Thủy" becomes "Th\\u1ee7y".
|
||||
// Combines ConvertUTF8ToUnicodeEscapes + DoubleEscapeUnicode in one call.
|
||||
static std::string ConvertUTF8ToDoubleEscapedUnicode(const std::string& utf8Str);
|
||||
|
||||
// Unescape double-escaped Unicode: "Th\\u1ee7y" becomes "Th\u1ee7y".
|
||||
// Reverses DoubleEscapeUnicode so other languages can parse \uXXXX correctly.
|
||||
static std::string UnescapeDoubleEscapedUnicode(const std::string& str);
|
||||
};
|
||||
// Connection bundle for pool
|
||||
struct S3Connection {
|
||||
@@ -259,6 +276,10 @@ extern "C" ANSULT_API int ANSDecodeJsonUnicodeToUTF16LE(const char* escapedStr,
|
||||
extern "C" ANSULT_API int ANSConvertUTF16LEToUTF8(const unsigned char* utf16leBytes, int byteLen, LStrHandle result);
|
||||
extern "C" ANSULT_API int ANSConvertUTF16LEToUnicodeEscapes(const unsigned char* utf16leBytes, int byteLen, LStrHandle result);
|
||||
extern "C" ANSULT_API int ANSConvertUnicodeEscapesToUTF8(const char* escapedStr, LStrHandle result);
|
||||
extern "C" ANSULT_API int ANSConvertUTF8ToUnicodeEscapes(const char* utf8Str, LStrHandle result);
|
||||
extern "C" ANSULT_API int ANSDoubleEscapeUnicode(const char* str, LStrHandle result);
|
||||
extern "C" ANSULT_API int ANSConvertUTF8ToDoubleEscapedUnicode(const char* utf8Str, LStrHandle result);
|
||||
extern "C" ANSULT_API int ANSUnescapeDoubleEscapedUnicode(const char* str, LStrHandle result);
|
||||
|
||||
// AWS S3 class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user