- case IDC_NOXLAT:
- case IDC_KOI8WIN1251:
- case IDC_88592WIN1250:
- case IDC_88592CP852:
- cfg.xlat_enablekoiwin =
- IsDlgButtonChecked(hwnd, IDC_KOI8WIN1251);
- cfg.xlat_88592w1250 =
- IsDlgButtonChecked(hwnd, IDC_88592WIN1250);
- cfg.xlat_88592cp852 =
- IsDlgButtonChecked(hwnd, IDC_88592CP852);
- break;
- case IDC_CAPSLOCKCYR:
- if (HIWORD(wParam) == BN_CLICKED ||
- HIWORD(wParam) == BN_DOUBLECLICKED) {
- cfg.xlat_capslockcyr =
- IsDlgButtonChecked(hwnd, IDC_CAPSLOCKCYR);
+ case IDC_CODEPAGE:
+ if (HIWORD(wParam) == EN_CHANGE)
+ GetDlgItemText(hwnd, IDC_CODEPAGE, cfg.line_codepage,
+ sizeof(cfg.line_codepage) - 1);
+ if (HIWORD(wParam) == EN_KILLFOCUS) {
+ int cp = decode_codepage(cfg.line_codepage);
+ char buf[256];
+ if (cp < -1) {
+ if (cp == -2)
+ sprintf(buf,
+ "Unable to identify character set '%s', "
+ "translation disabled.",
+ cfg.line_codepage);
+ if (cp == -3)
+ sprintf(buf,
+ "Character set '%s' is a DBCS, "
+ "translation is not available.",
+ cfg.line_codepage);
+ MessageBox(hwnd, buf, "PuTTY Error",
+ MB_ICONERROR | MB_OK);
+ }
+ strcpy(cfg.line_codepage, cp_name(cp));
+ SetDlgItemText(hwnd, IDC_CODEPAGE, cfg.line_codepage);