Created
November 11, 2013 23:34
-
-
Save kgadek/7422579 to your computer and use it in GitHub Desktop.
Fixer dla Malwiny
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <cstdlib> | |
int main() { | |
int ch; | |
int cha; | |
ch = getchar(); | |
if(ch == 0xEF) { | |
getchar(); // 0xBB | |
getchar(); // 0xBF | |
ch = getchar(); // ?? | |
} | |
do { | |
if(ch == EOF) | |
break; | |
if(ch <= 0x007F) { | |
putchar(ch); | |
} else if(ch <= 0x07FF) { | |
cha = (ch & 0x1F) << 6; | |
cha += (getchar() & 0x3F); | |
if(cha == 0x153) | |
putchar(cha=0x9C); | |
else | |
putchar(cha); | |
} else if(ch <= 0xFFFF) { | |
cha = (ch & 0x0F) << 12; | |
cha += (getchar() & 0x3F) << 6; | |
cha += (getchar() & 0x3F); | |
putchar(cha); | |
} // else skip! | |
} while(EOF != (ch = getchar())); | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment