summaryrefslogtreecommitdiffstats
path: root/src/tests/utf8-test.c
blob: c8b2fabb7bfbce633d91d0ff1f70e792f644fd1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* $Id$ */

#include <stdio.h>
#include <assert.h>

#include <polypcore/utf8.h>
#include <polypcore/xmalloc.h>

int main(int argc, char *argv[]) {
    char *c;
    
    assert(pa_utf8_valid("hallo"));
    assert(pa_utf8_valid("hallo\n"));
    assert(!pa_utf8_valid("hüpfburg\n"));
    assert(pa_utf8_valid("hallo\n"));
    assert(pa_utf8_valid("hüpfburg\n"));
    
    printf("LATIN1: %s\n", c = pa_utf8_filter("hüpfburg"));
    pa_xfree(c);
    printf("UTF8: %sx\n", c = pa_utf8_filter("hüpfburg"));
    pa_xfree(c);
    printf("LATIN1: %sx\n", c = pa_utf8_filter("üxknärzmörzeltörszß³§dsjkfh"));
    pa_xfree(c);

    return 0;
}