Support unicode APIs for LabVIEW

This commit is contained in:
2026-04-06 14:20:43 +10:00
parent 091a61d2be
commit b98aed21bf
4 changed files with 98 additions and 2 deletions

View File

@@ -102,6 +102,16 @@ namespace ANSCENTER {
// Convert a UTF-16LE byte string to UTF-8.
// Useful for receiving Unicode text from LabVIEW and converting to UTF-8 for internal processing.
static std::string ConvertUTF16LEToUTF8(const char* utf16leBytes, int byteLen);
// Convert UTF-16LE byte string (with optional BOM) to Unicode escape sequences (\uXXXX).
// Input: raw UTF-16LE bytes (BOM is auto-stripped if present).
// Output: ASCII string with \uXXXX for non-ASCII codepoints, plain ASCII chars preserved.
static std::string ConvertUTF16LEToUnicodeEscapes(const char* utf16leBytes, int byteLen);
// Convert Unicode escape sequences (\uXXXX) to UTF-8 string.
// 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);
};
// Connection bundle for pool
struct S3Connection {
@@ -247,6 +257,8 @@ extern "C" ANSULT_API int RebootSystem();
extern "C" ANSULT_API int ANSConvertUTF8ToUTF16LE(const char* utf8Str, LStrHandle result, int includeBOM = 1);
extern "C" ANSULT_API int ANSDecodeJsonUnicodeToUTF16LE(const char* escapedStr, LStrHandle result);
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);
// AWS S3 class