I am trying to write a program for translating English to Greek. So I find the ASCII number of the English character (a) and then saving the new char to a file. However is still saves 'á' and not 'α' cause they have the same decimal number.
int main(int argc, char *argv[]) {
FILE *fp1, *fp2;
char ch,demo;
int i;
fp1 = fopen( argv[1], "r");
fp2 = fopen("Translated.txt", "w");
while (1) {
ch = fgetc(fp1);
if (ch == EOF)
break;
else{
i = ch + 128;
demo = i;
putc(demo, fp2);
}
}
printf("File copied Successfully!");
fclose(fp1);
fclose(fp2);
return 0;
}
How can I save a file as UTF-8 in order to view it as a Greek character ? Any other way of converting ISO8859-1 to ISO8859-7 ?