- const int32_t bufSize = 256;
- int32_t bufLen = 0;
- UChar temp[bufSize];
-
- int32_t inputLen = 0, decompLen;
- UChar stackBuffer[4];
- const UChar *decomp;
-
- U16_APPEND_UNSAFE(temp, inputLen, comp);
- decomp = unorm_getCanonicalDecomposition(comp, stackBuffer, &decompLen);
- if(decomp == NULL) {
- /* copy temp */
- stackBuffer[0] = temp[0];
- if(inputLen > 1) {
- stackBuffer[1] = temp[1];
- }
- decomp = stackBuffer;
- decompLen = inputLen;
+ UnicodeString temp(comp);
+ int32_t inputLen=temp.length();
+ UnicodeString decompString;
+ nfd.normalize(temp, decompString, status);
+ if (U_FAILURE(status)) {
+ return NULL;