how to convert UTF16 to UTF8 string without dataloss to use in fopen()

sayan

Registered
does anyone know how to convert UTF 16 string to UTF 8 string without data loss.??


i have converted ASCII string to UTF 16 string with following code ::

UniChar* ASCII2Uni(const char* filepath)
{

CFStringRef name = CFStringCreateWithCString(kCFAllocatorDefault, filepath, kCFStringEncodingUTF16);

const UniChar* nameChars = CFStringGetCharactersPtr(name);
return nameChars;

}


Please inform me whether my ASCII2Uni is correct or not also ??
 
Back
Top