CharArrayToString bug with build 5660 New comment Le Minh Duc 2026.03.02 17:18 I just discovered an error when decoding base64 code after updating the terminal (in previous versions this error was not encountered) string Base64Encode(string text) { uchar src[], dst[], key[] = {}; StringToCharArray(text, src, 0, -1, CP_UTF8); ArrayResize(src, ArraySize(src) - 1); int res = CryptEncode(CRYPT_BASE64, src, key, dst); return (res > 0) ? CharArrayToString(dst, 0, -1, CP_ACP) : ""; } string Base64Decode(string text) { uchar src[], dst[], key[] = {}; StringToCharArray(text, src, 0, -1, CP_ACP); ArrayResize(src, ArraySize(src) - 1); int res = CryptDecode(CRYPT_BASE64, src, key, dst); return (res > 0) ? CharArrayToString(dst, 0, res, CP_UTF8) : ""; } void OnStart() { string o = "«abc»—"; string en = Base64Encode(o); string de = Base64Decode(en); Print(o); Print(en); Print(de); } Result: Alain Verleyen 2026.03.02 17:34 #1 Confirmed and reported to MQ. The problem is with CharArrayToString() so I edited your topic. Le Minh Duc 2026.03.02 17:49 #2 Alain Verleyen #: Confirmed and reported to MQ. The problem is with CharArrayToString() so I edited your topic. Thank you Alain Verleyen 2026.03.03 12:26 #3 Fixed from build 5663. Le Minh Duc 2026.03.03 13:38 #4 It raises another problem. 1 leaked strings left when I run this code. Is it a bug and does it affect long-term performance? Alain Verleyen #: Fixed from build 5663. Alain Verleyen 2026.03.03 13:53 #5 Le Minh Duc #: It raises another problem. 1 leaked strings left when I run this code. Is it a bug and does it affect long-term performance? Yes know issue already reported. Alain Verleyen 2026.03.03 15:50 #6 Le Minh Duc #: It raises another problem. 1 leaked strings left when I run this code. Is it a bug and does it affect long-term performance? Fixed in build 5664. New comment
I just discovered an error when decoding base64 code after updating the terminal (in previous versions this error was not encountered)
Result: