Your program didn't work on my machine and I suspect it may be a compiler issue.
What did work for me, gcc 4.4.7 on CentOS 6 is the following code. Hope this will be useful for others who may have had problems. #include <stdio.h> #include <string.h> int main() { char buf[100]; int len, i, code; char chr; while (fgets (buf, sizeof(buf), stdin)) { len = strlen (buf) - 1; for (i = 0; i < len; i++) { i++; code = buf[i] & 0xff; i++; chr = buf[i] & 0xff; if (code == 0xbf) printf("%c", 223 - chr); else printf("%c", 287 - chr); } } printf("\n"); }