Regular strings above assume each character can be stored in 8-bits; however this character size is not appropriate for many languages so 010 Editor also supports wide strings (also called Unicode strings) where each character is a 16-bit unsigned short. Use the special 'wstring' type to define a wide string and each character of a wstring is assumed to be of type 'wchar_t' (a wchar_t is equivalent to an unsigned short).
The same operators '=', '+' and '+=' are supported for wstrings as for strings and a wide string constant can be declared by placing a 'L' character before a string or character constant. For example:
wchar_t str1[15] = L"How now";
wstring str2 = "brown cow";
wstring str3 = str1 + L' ' + str2 + L'?';
Extended characters can be placed in string constants using the UTF-8 character encoding. Wide strings are assumed to be null-terminated and a list of functions available for working with wide strings is available in the String Functions help topic. Wide strings can be converted to regular strings using the WStringToString or StringToWString functions, or by casting.
typedef struct (int size)
{
wchar_t string[size];
} string_XOR <read=StringXORRead>;
string StringXORRead(string_XOR &str) {
wstring s;
int i;
s = "";
for (i = 0; i < WStrlen(str); i ++)
s = s + (str[i] ^ 0xFFFF);
return s;
}
string StringXORRead(string_XOR &str) {
wstring s;
local wchar_t t;
int i;
s = "";
for (i = 0; i < WStrlen(str.xorchar); i ++)
{
t = str.xorchar[i];
t ^= 0xFFFF;
s = s + t;
}
return s;
}