]> pilppa.org Git - libcharencoding.git/blob - src_test/libcharencoding_test.c
libcharencoding: initial version
[libcharencoding.git] / src_test / libcharencoding_test.c
1 /**
2  * Copyright (c) 2009-2010 Mika Laitio <lamikr@pilppa.org>
3  *
4  * This library is covered by the LGPL version 3, read LICENSE for details.
5  *
6  * History:
7  * - Created libcharencoding_test.c on: Nov 25, 2009
8  */
9
10 #include <stdio.h>
11 #include <readline/readline.h>
12
13 #include "charencoding.h"
14
15 char *get_input_encoded_to_utf8()
16 {
17         char    *text;
18         char    *ret_val;
19         int     err_flg;
20
21         printf("enter text: ");
22         text    = readline("");
23         ret_val = utf8_encode(text, &err_flg);
24         return ret_val;
25 }
26
27 int main(void)
28 {
29         char    *utf8s;
30         printf("is_utf8_locale: %d\n", is_utf8_locale());
31         utf8s = get_input_encoded_to_utf8();
32         utf8_printf("%s\n", utf8s);
33         return 0;
34 }