Skip to content

Commit 9a50a7d

Browse files
committed
Corrections of the codepage number for some collations.
According to https://msdn.microsoft.com/en-us/library/windows/desktop/dd317756(v=vs.85).aspx code page for latin1 is 1252, and not 850. The same for some other collations. Changed "auto" charset detection to use only GetACP() on windows. Since I guess C/ODBC is the only user of that feature, and because GetConsoleCP() returns OEM codepage, and not the default system codepage, which is used by DM as source codepage for recoding to unicode.
1 parent 60e5dee commit 9a50a7d

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

libmariadb/ma_charset.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -549,8 +549,8 @@ const MARIADB_CHARSET_INFO mariadb_compiled_charsets[] =
549549
{ 3, 1, "dec8", "dec8_swedisch_ci", "", 0, "DEC", 1, 1, NULL, NULL},
550550
{ 4, 1, "cp850", "cp850_general_ci", "", 850, "CP850", 1, 1, NULL, NULL},
551551
{ 6, 1, "hp8", "hp8_english_ci", "", 0, "HP-ROMAN8", 1, 1, NULL, NULL},
552-
{ 7, 1, "koi8r", "koi8r_general_ci", "", 878, "KOI8R", 1, 1, NULL, NULL},
553-
{ 8, 1, "latin1", "latin1_swedish_ci", "", 850, "LATIN1", 1, 1, NULL, NULL},
552+
{ 7, 1, "koi8r", "koi8r_general_ci", "", 20866, "KOI8R", 1, 1, NULL, NULL},
553+
{ 8, 1, "latin1", "latin1_swedish_ci", "", 1252, "LATIN1", 1, 1, NULL, NULL},
554554
{ 9, 1, "latin2", "latin2_general_ci", "", 852, "LATIN2", 1, 1, NULL, NULL},
555555
{ 10, 1, "swe7", "swe7_swedish_ci", "", 20107, "", 1, 1, NULL, NULL},
556556
{ 11, 1, "ascii", "ascii_general_ci", "", 1252, "ASCII", 1, 1, NULL, NULL},
@@ -559,7 +559,7 @@ const MARIADB_CHARSET_INFO mariadb_compiled_charsets[] =
559559
{ 16, 1, "hebrew", "hebrew_general_ci", "", 1255, "HEBREW", 1, 1, NULL, NULL},
560560
{ 18, 1, "tis620", "tis620_thai_ci", "", 874, "TIS620", 1, 1, NULL, NULL},
561561
{ 19, 1, "euckr", "euckr_korean_ci", "", 51949, "EUCKR", 1, 2, mysql_mbcharlen_euckr, check_mb_euckr},
562-
{ 22, 1, "koi8u", "koi8u_general_ci", "", 20866, "KOI8U", 1, 1, NULL, NULL},
562+
{ 22, 1, "koi8u", "koi8u_general_ci", "", 21866, "KOI8U", 1, 1, NULL, NULL},
563563
{ 24, 1, "gb2312", "gb2312_chinese_ci", "", 936, "GB2312", 1, 2, mysql_mbcharlen_gb2312, check_mb_gb2312},
564564
{ 25, 1, "greek", "greek_general_ci", "", 28597, "GREEK", 1, 1, NULL, NULL},
565565
{ 26, 1, "cp1250", "cp1250_general_ci", "", 1250, "CP1250", 1, 1, NULL, NULL},
@@ -583,16 +583,16 @@ const MARIADB_CHARSET_INFO mariadb_compiled_charsets[] =
583583
{ 95, 1, "cp932", "cp932_japanese_ci", "", 932, "CP932", 1, 2, mysql_mbcharlen_cp932, check_mb_cp932},
584584
{ 97, 1, "eucjpms", "eucjpms_japanese_ci", "", 932, "EUC-JP-MS", 1, 3, mysql_mbcharlen_eucjpms, check_mb_eucjpms},
585585
{ 2, 1, "latin2", "latin2_czech_cs", "", 852, "LATIN2", 1, 1, NULL, NULL},
586-
{ 5, 1, "latin1", "latin1_german_ci", "", 850, "LATIN1", 1, 1, NULL, NULL},
586+
{ 5, 1, "latin1", "latin1_german_ci", "", 1252, "LATIN1", 1, 1, NULL, NULL},
587587
{ 14, 1, "cp1251", "cp1251_bulgarian_ci", "", 1251, "CP1251", 1, 1, NULL, NULL},
588-
{ 15, 1, "latin1", "latin1_danish_ci", "", 850, "LATIN1", 1, 1, NULL, NULL},
588+
{ 15, 1, "latin1", "latin1_danish_ci", "", 1252, "LATIN1", 1, 1, NULL, NULL},
589589
{ 17, 1, "filename", "filename", "", 0, "", 1, 5, NULL, NULL},
590590
{ 20, 1, "latin7", "latin7_estonian_cs", "", 28603, "LATIN7", 1, 1, NULL, NULL},
591591
{ 21, 1, "latin2", "latin2_hungarian_ci", "", 852, "LATIN2", 1, 1, NULL, NULL},
592592
{ 23, 1, "cp1251", "cp1251_ukrainian_ci", "", 1251, "CP1251", 1, 1, NULL, NULL},
593593
{ 27, 1, "latin2", "latin2_croatian_ci", "", 852, "LATIN2", 1, 1, NULL, NULL},
594594
{ 29, 1, "cp1257", "cp1257_lithunian_ci", "", 1257, "CP1257", 1, 1, NULL, NULL},
595-
{ 31, 1, "latin1", "latin1_german2_ci", "", 850, "LATIN1", 1, 1, NULL, NULL},
595+
{ 31, 1, "latin1", "latin1_german2_ci", "", 1252, "LATIN1", 1, 1, NULL, NULL},
596596
{ 34, 1, "cp1250", "cp1250_czech_cs", "", 1250, "CP1250", 1, 1, NULL, NULL},
597597
{ 42, 1, "latin7", "latin7_general_cs", "", 28603, "LATIN7", 1, 1, NULL, NULL},
598598
{ 43, 1, "macce", "macce_bin", "", 10029, "CP1282", 1, 1, NULL, NULL},
@@ -1349,8 +1349,7 @@ const char *madb_get_os_character_set()
13491349
char *p= NULL;
13501350
#ifdef _WIN32
13511351
char codepage[FN_REFLEN];
1352-
snprintf(codepage, FN_REFLEN, "%u", GetConsoleWindow() ?
1353-
GetConsoleCP() : GetACP());
1352+
snprintf(codepage, FN_REFLEN, "%u", GetACP());
13541353
p= codepage;
13551354
#elif defined(HAVE_NL_LANGINFO) && defined(HAVE_SETLOCALE)
13561355
if (setlocale(LC_CTYPE, ""))

0 commit comments

Comments
 (0)