cutef8
cutef8 copied to clipboard
u8_unescape() swallows character
Hi, I found this library and I like it since it's very compact.
Something that boggles my mind, with this test program:
#include <stdio.h> //printf
#include <stdlib.h> //malloc
#include <locale.h>
#include "utf8.h"
//gcc -o testutf8 testutf8.c utf8.o
int main(int argc, char *args[])
{
char *locale;
locale = setlocale(LC_ALL, "");
char *str="a£b\\u2620";
char *un=malloc(100);
u8_unescape(un, 100, str);
printf("%s\n", str);
printf("%s\n", un);
return 0;
}
I get the following output:
$ ./testutf8
a£b\u2620
ab☠
Expected output was:
a£b☠
Why is the char '£' removed after u8_unescape()
, is there anything wrong with the example code?
Thanks for any hints.