How do you convert a wchar_t* returned by a C DLL to a String?

Yes, I meant the original version in this post, which treated each 16-bit codepoint as if it were a character.

The final version with should be better, however, scanning first for a 16-bit 0, wrapping the pointed to words as a Vector, and then scanning the string yet again to calculate the length in UTF-8, before finally creating the String version will not be that efficient.

Yes, although I’d have separate methods instead of calling wcslen(p), to avoid scanning twice, and Cwstring can be 16-bit or 32-bit characters, depending on platform, so for UTF-16:
i.e. unsafe_transcode(String, p::Ptr{UInt16}) and unsafe_transcode(String, p::Ptr{UInt16}, len::Int)