From: Anatol Belski Date: Tue, 20 Dec 2016 01:40:44 +0000 (+0100) Subject: deliver the real cp also if a constant is passed X-Git-Tag: php-7.1.1RC1~72 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=21e283647369bfd027c3d9fb740be219da05bc5c;p=php deliver the real cp also if a constant is passed --- diff --git a/win32/codepage.c b/win32/codepage.c index f87d4c0900..519ff03f4b 100644 --- a/win32/codepage.c +++ b/win32/codepage.c @@ -266,6 +266,17 @@ PW32CP const struct php_win32_cp *php_win32_cp_get_by_id(DWORD id) {/*{{{*/ size_t i; + if (id < php_win32_cp_map[0].id) { + switch (id) { + case CP_ACP: + id = GetACP(); + break; + case CP_OEMCP: + id = GetOEMCP(); + break; + } + } + for (i = 0; i < sizeof(php_win32_cp_map)/sizeof(struct php_win32_cp); i++) { if (php_win32_cp_map[i].id == id) { return &php_win32_cp_map[i];