I do it head to head; if he has problems, comment and I will really check it out.
// Check our byte order. Assuming we made the string as in your example CFStringEncoding encoding = (CFByteOrderLittleEndian == CFByteOrderGetCurrent()) ? kCFStringEncodingUTF32LE : kCFStringEncodingUTF32BE; int widecharvarLen = wcslen(widecharvar); CFStringRef string = CFStringCreateWithBytes(NULL, widecharvar, (widecharvarLen * sizeof(wchar_t)), encoding, false);
This last false means that the line does not include the specification (bytes), which is the line that I assume you are dealing with.
source share