This method is converting native encoded text in a dataref to UTF-16 encoded text in the way Windows likes it. So...

Decode input dataref as stringref in native encoding.
Convert line-endings from LiveCode
Encode stringref into a dataref using UTF-16 encoding

Then, as above, if the resulting dataref is empty, or does not end with two NUL bytes, then add 2 NUL bytes (using MCDataPad).