This file looks large and may slow your browser down if we attempt
to syntax highlight it, so we are showing it without any
pretty colors.
Highlight
it anyway.
| 1 |
/* |
| 2 |
* test.c |
| 3 |
* Copyright (C) 2009 Adrian Perez <aperez@igalia.com> |
| 4 |
* |
| 5 |
* Distributed under terms of the MIT license. |
| 6 |
*/ |
| 7 |
|
| 8 |
#include "gchardet.h" |
| 9 |
#include <stdio.h> |
| 10 |
#include <glib.h> |
| 11 |
|
| 12 |
int |
| 13 |
main(int argc, char **argv) |
| 14 |
{ |
| 15 |
gchar c; |
| 16 |
g_chardet_t *cd = g_chardet_new (G_CHARDET_ALL); |
| 17 |
|
| 18 |
while ((c = getchar()) != EOF && !g_chardet_handle (cd, &c, 1)); |
| 19 |
g_chardet_finish (cd); |
| 20 |
|
| 21 |
if (g_chardet_charset (cd) != NULL) |
| 22 |
g_print ("%s\n", g_chardet_charset (cd)); |
| 23 |
else |
| 24 |
g_print ("Unable to detect charset\n"); |
| 25 |
|
| 26 |
g_chardet_free (cd); |
| 27 |
|
| 28 |
return 0; |
| 29 |
} |