6 * charset - character set conversion and validation routines
8 * This module provides a collection (well, only one, at the moment) of
9 * well-tested routines for dealing with character set nonsense.
11 * Validation functions:
12 * - bool utf8_validate(const char *str, size_t length);
18 * #include <ccan/charset/charset.h>
19 * #include <ccan/grab_file/grab_file.h>
20 * #include <ccan/talloc/talloc.h> // For talloc_free()
22 * int main(int argc, char *argv[])
29 * err(1, "Expected exactly one argument");
31 * file = grab_file(NULL, argv[1], &len);
33 * err(1, "Could not read file %s", argv[1]);
35 * valid = utf8_validate(file, len);
36 * printf("File contents are %s UTF-8\n", valid ? "valid" : "invalid");
46 int main(int argc, char *argv[])
48 /* Expect exactly one argument */
52 if (strcmp(argv[1], "depends") == 0) {
57 if (strcmp(argv[1], "libs") == 0) {
58 printf("m\n"); /* Needed for the pow() invocation in run.c */