Closed zetsin closed 8 years ago
That CString
only supports characters of 1 bytes (see the implementation of write and read CString methods). That encoding is only for selecting ASCII or UTF8.
Maybe that would be a good idea to support wide strings, but I believe that gotta be a separate ref type, say, WString
.
Give https://github.com/TooTallNate/ref-wchar a shot!
Inside the function of ref.allocCString: var size = Buffer.byteLength(string, encoding) + 1
There is error while setting encoding 'utf16le', because utf16 string terminator is the two-byte sequence 0x00 0x00. Maybe you should do this: var size = Buffer.byteLength(string + '\0', encoding)