Heres a start, this seems to work on OSX. I don't know what the windows code should look like:
staticvoid
copyConvertUTF16IntoStringLiteral(
constA_UTF16Char* inputString,
A_char* destination)
{
//is there a way to determine the length of a UTF16Char string?
int length = AEGP_MAX_PATH_SIZE;
#ifdef AE_OS_MAC
NSString *stringNS = [NSStringstringWithCharacters:inputString length:length];
strcpy(destination, reinterpret_cast<constA_char *>([stringNS cStringUsingEncoding:NSUTF8StringEncoding]));
[stringNS release];
#elif defined AE_OS_WIN
//please note, the windows code has not been tested to work.
//TODO: add windows code
#endif
}
I would love to know what the windows equivalent logic should look like, but I'm not building on Windows yet, so didn't look into it.
I would also love to know how to get the size of a A_UTF16Char string. Its hardwired to AEGP_MAX_PATH_SIZE in the example above, but that is obviously not very generic.
thanks!
-Andy