Created
March 11, 2012 18:40
Revisions
-
dajobe created this gist
Mar 11, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ /* * 4.8 if the pkgconfig files are present: * gcc -g -o icu_is_nfc icu_is_nfc.c `pkg-config icu-uc --cflags --libs` * * Portable: * gcc -g -o icu_is_nfc icu_is_nfc.c `icu-config --cppflags-searchpath --ldflags-searchpath` -licuuc */ #include <stdio.h> #include <unicode/unorm.h> int raptor_icu_is_nfc(const unsigned char* string, size_t len) { UNormalizationCheckResult res; UErrorCode error_code = U_ZERO_ERROR; res = unorm_quickCheck((const UChar *)string, (int32_t)len, UNORM_NFC, &error_code); return U_SUCCESS(error_code) && (res == UNORM_YES); } int main (int argc, char *argv[]) { #define BUFLEN 3 char buffer[BUFLEN + 1]="abc\0"; int res; res = raptor_icu_is_nfc(buffer, BUFLEN); fprintf(stderr, "Result is %d\n", res); return(0); }