IIRC D2 does only support PWideChar as "string" type, but not unicodestring nor widestring.
Delphi 2 supported short strings (
String[N]), long strings (
AnsiString), and
P(Ansi|Wide)Char null-terminated character pointers.
AnsiString was added in Delphi 2.
WideString was added in Delphi 3.
UnicodeString was added in Delphi 2009.
More over, the length is 4 bytes for WideString regardless of 32/64 bit application. When constant length is needed, a shift right (division by 2) is produced by the compiler to convert from bytes to codepoints.
More accurately, dividing the byte length by 2 (aka
sizeof(WideChar)) will produce a count of
codeunits, not
codepoints.
WideString is encoded using UTF-16 (or UCS-2 prior to Win2k), so the character length of a UTF-16/UCS-2 string is the number of 16-bit units it holds, not the number of Unicode codepoints they represent. In UTF-16, it takes two 16-bit units to represent codepoints > U+FFFF.