Switch from default to user defined codepage

This commit is contained in:
Andrew Pamment 2017-04-23 12:31:03 +10:00
parent 8b611fc3fe
commit db59e0e4b2

View File

@ -309,10 +309,10 @@ void runexternal(struct user_record *user, char *cmd, int stdio, char *argv[], c
} }
} }
} }
if (codepage == NULL || (strcmp(codepage, "CP437") == 0 && conf.codepage == 0) || (strcmp(codepage, "UTF-8") == 0 && conf.codepage == 1)) { if (codepage == NULL || (strcmp(codepage, "CP437") == 0 && gUser->codepage == 0) || (strcmp(codepage, "UTF-8") == 0 && gUser->codepage == 1)) {
write(master, outbuf, g); write(master, outbuf, g);
} else { } else {
if (conf.codepage == 0) { if (gUser->codepage == 0) {
ic = iconv_open("CP437", codepage); ic = iconv_open("CP437", codepage);
} else { } else {
ic = iconv_open("UTF-8", codepage); ic = iconv_open("UTF-8", codepage);
@ -344,10 +344,10 @@ void runexternal(struct user_record *user, char *cmd, int stdio, char *argv[], c
} }
outbuf[g++] = c; outbuf[g++] = c;
} }
if (codepage == NULL || (strcmp(codepage, "CP437") == 0 && conf.codepage == 0) || (strcmp(codepage, "UTF-8") == 0 && conf.codepage == 1)) { if (codepage == NULL || (strcmp(codepage, "CP437") == 0 && gUser->codepage == 0) || (strcmp(codepage, "UTF-8") == 0 && gUser->codepage == 1)) {
write(door_out, outbuf, g); write(door_out, outbuf, g);
} else { } else {
if (conf.codepage == 0) { if (gUser->codepage == 0) {
ic = iconv_open(codepage, "CP437"); ic = iconv_open(codepage, "CP437");
} else { } else {
ic = iconv_open(codepage, "UTF-8"); ic = iconv_open(codepage, "UTF-8");