Created
March 11, 2012 18:40
-
-
Save dajobe/2017632 to your computer and use it in GitHub Desktop.
icu_is_nfc.c
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 characters
/* | |
* 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); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment