Support UTF8 to UTF16 LE

This commit is contained in:
2026-03-31 14:10:21 +11:00
parent 0c24096c80
commit 70be68d0fc
14 changed files with 790 additions and 11 deletions

View File

@@ -89,6 +89,19 @@ namespace ANSCENTER {
// Restart PC
[[nodiscard]] static bool RestartPC();
// Convert a UTF-8 encoded string to UTF-16LE byte string.
// Useful for LabVIEW which can display UTF-16LE Unicode text on Windows.
static std::string ConvertUTF8ToUTF16LE(const std::string& utf8Str);
// Decode JSON Unicode escape sequences (\uXXXX) to UTF-16LE byte string.
// Input: ASCII string with \uXXXX escapes (e.g., "\\u6c5f\\u6771 599")
// Output: UTF-16LE byte string for LabVIEW display.
static std::string DecodeJsonUnicodeToUTF16LE(const std::string& escapedStr);
// 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);
};
// Connection bundle for pool
struct S3Connection {
@@ -230,6 +243,10 @@ extern "C" ANSULT_API int SendEmail(const char* smtpServer, int port,
extern "C" ANSULT_API int RebootSystem();
// Unicode conversion utilities for LabVIEW
extern "C" ANSULT_API int ANSConvertUTF8ToUTF16LE(const char* utf8Str, LStrHandle result);
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);
// AWS S3 class