#include "unicode.h"
#include <stdlib.h>
#ifdef __APPLE__
#include <CoreFoundation/CoreFoundation.h>
char* StringNFD2NFC(
const char *str) {
CFStringRef nfd = CFStringCreateWithCString(
NULL, str, kCFStringEncodingUTF8);
CFMutableStringRef nfc = CFStringCreateMutableCopy(
NULL,
0, nfd);
CFStringNormalize(nfc, kCFStringNormalizationFormC);
CFIndex length16 = CFStringGetLength(nfc);
size_t buflen = (length16+
1) *
4;
char *cstr = malloc(buflen);
if(!cstr) {
exit(-
1);
}
CFStringGetCString(nfc, cstr, buflen, kCFStringEncodingUTF8);
CFRelease(nfc);
CFRelease(nfd);
return cstr;
}
#endif