Read text and print each (byte) character in separate line
Posted
by
user2967663
on Stack Overflow
See other posts from Stack Overflow
or by user2967663
Published on 2013-11-09T09:21:54Z
Indexed on
2013/11/09
9:53 UTC
Read the original article
Hit count: 132
preforming this code to read file and print each character \ (byte) in separate line
works well with ASCII
void
preprocess_file (FILE *fp)
{
int cc;
for (;;)
{
cc = getc (fp);
if (cc == EOF)
break;
printf ("%c\n", cc);
}
}
int
main(int argc, char *argv [])
{
preprocess_file (stdin);
exit (0);
}
but when i use it with UTF-8 encoded text it shows unredable character such as
ï
»
?
?
§
?
„
?
…
?
¤
?
´
?
and advice ?
Thanks
© Stack Overflow or respective owner