1: if (!*cp_name) {
2: /*
3: * Here we select a plausible default code page based on
4: * the locale the user is in. We wish to select an ISO code
5: * page or appropriate local default _rather_ than go with
6: * the Win125* series, because it's more important to have
7: * CSI and friends enabled by default than the ghastly
8: * Windows extra quote characters, and because it's more
9: * likely the user is connecting to a remote server that
10: * does something Unixy or VMSy and hence standards-
11: * compliant than that they're connecting back to a Windows
12: * box using horrible nonstandard charsets.
13: *
14: * Accordingly, Robert de Bath suggests a method for
15: * picking a default character set that runs as follows:
16: * first call GetACP to get the system's ANSI code page
17: * identifier, and translate as follows:
18: *
19: * 1250 -> ISO 8859-2
20: * 1251 -> KOI8-U
21: * 1252 -> ISO 8859-1
22: * 1253 -> ISO 8859-7
23: * 1254 -> ISO 8859-9
24: * 1255 -> ISO 8859-8
25: * 1256 -> ISO 8859-6
26: * 1257 -> ISO 8859-13 (changed from 8859-4 on advice of a Lithuanian)
27: *
28: * and for anything else, choose direct-to-font.
29: */
30: int cp = GetACP();
31: switch (cp) {
32: case 1250: cp_name = "ISO-8859-2"; break;
33: case 1251: cp_name = "KOI8-U"; break;
34: case 1252: cp_name = "ISO-8859-1"; break;
35: case 1253: cp_name = "ISO-8859-7"; break;
36: case 1254: cp_name = "ISO-8859-9"; break;
37: case 1255: cp_name = "ISO-8859-8"; break;
38: case 1256: cp_name = "ISO-8859-6"; break;
39: case 1257: cp_name = "ISO-8859-13"; break;
40: /* default: leave it blank, which will select -1, direct->font */
41: }
42: }