Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

u8_unescape() swallows character #4

Open
7890 opened this issue Apr 23, 2019 · 0 comments
Open

u8_unescape() swallows character #4

7890 opened this issue Apr 23, 2019 · 0 comments

Comments

@7890
Copy link

7890 commented Apr 23, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant