31
31
32
32
import java .nio .charset .Charset ;
33
33
import java .util .ArrayList ;
34
+ import java .util .Arrays ;
34
35
import java .util .Collections ;
35
36
import java .util .HashMap ;
36
37
import java .util .HashSet ;
@@ -197,7 +198,8 @@ public class CharsetMapping {
197
198
JAVA_ENCODING_UC_TO_MYSQL_CHARSET = Collections .unmodifiableMap (javaUcToMysqlCharsetMap );
198
199
MULTIBYTE_ENCODINGS = Collections .unmodifiableSet (tempMultibyteEncodings );
199
200
200
- // complete list of mysql collations and their corresponding character sets each element of collation[1]..collation[MAP_SIZE-1] must not be null
201
+ // Complete list of MySQL collations and their corresponding character set.
202
+ // Collations may have different default names in different MySQL versions, while the remaining are accepted as aliases.
201
203
Collation [] collation = new Collation [MAP_SIZE ];
202
204
collation [1 ] = new Collation (1 , "big5_chinese_ci" , 1 , MYSQL_CHARSET_NAME_big5 );
203
205
collation [2 ] = new Collation (2 , "latin2_czech_cs" , 0 , MYSQL_CHARSET_NAME_latin2 );
@@ -215,7 +217,7 @@ public class CharsetMapping {
215
217
collation [14 ] = new Collation (14 , "cp1251_bulgarian_ci" , 0 , MYSQL_CHARSET_NAME_cp1251 );
216
218
collation [15 ] = new Collation (15 , "latin1_danish_ci" , 0 , MYSQL_CHARSET_NAME_latin1 );
217
219
collation [16 ] = new Collation (16 , "hebrew_general_ci" , 0 , MYSQL_CHARSET_NAME_hebrew );
218
-
220
+ // 17
219
221
collation [18 ] = new Collation (18 , "tis620_thai_ci" , 0 , MYSQL_CHARSET_NAME_tis620 );
220
222
collation [19 ] = new Collation (19 , "euckr_korean_ci" , 0 , MYSQL_CHARSET_NAME_euckr );
221
223
collation [20 ] = new Collation (20 , "latin7_estonian_cs" , 0 , MYSQL_CHARSET_NAME_latin7 );
@@ -231,7 +233,7 @@ public class CharsetMapping {
231
233
collation [30 ] = new Collation (30 , "latin5_turkish_ci" , 1 , MYSQL_CHARSET_NAME_latin5 );
232
234
collation [31 ] = new Collation (31 , "latin1_german2_ci" , 0 , MYSQL_CHARSET_NAME_latin1 );
233
235
collation [32 ] = new Collation (32 , "armscii8_general_ci" , 0 , MYSQL_CHARSET_NAME_armscii8 );
234
- collation [33 ] = new Collation (33 , " utf8_general_ci" , 1 , MYSQL_CHARSET_NAME_utf8mb3 );
236
+ collation [33 ] = new Collation (33 , new String [] { "utf8mb3_general_ci" , " utf8_general_ci" } , 1 , MYSQL_CHARSET_NAME_utf8mb3 );
235
237
collation [34 ] = new Collation (34 , "cp1250_czech_cs" , 0 , MYSQL_CHARSET_NAME_cp1250 );
236
238
collation [35 ] = new Collation (35 , "ucs2_general_ci" , 1 , MYSQL_CHARSET_NAME_ucs2 );
237
239
collation [36 ] = new Collation (36 , "cp866_general_ci" , 1 , MYSQL_CHARSET_NAME_cp866 );
@@ -274,14 +276,14 @@ public class CharsetMapping {
274
276
collation [73 ] = new Collation (73 , "keybcs2_bin" , 0 , MYSQL_CHARSET_NAME_keybcs2 );
275
277
collation [74 ] = new Collation (74 , "koi8r_bin" , 0 , MYSQL_CHARSET_NAME_koi8r );
276
278
collation [75 ] = new Collation (75 , "koi8u_bin" , 0 , MYSQL_CHARSET_NAME_koi8u );
277
- collation [76 ] = new Collation (76 , " utf8_tolower_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
279
+ collation [76 ] = new Collation (76 , new String [] { "utf8mb3_tolower_ci" , " utf8_tolower_ci" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
278
280
collation [77 ] = new Collation (77 , "latin2_bin" , 0 , MYSQL_CHARSET_NAME_latin2 );
279
281
collation [78 ] = new Collation (78 , "latin5_bin" , 0 , MYSQL_CHARSET_NAME_latin5 );
280
282
collation [79 ] = new Collation (79 , "latin7_bin" , 0 , MYSQL_CHARSET_NAME_latin7 );
281
283
collation [80 ] = new Collation (80 , "cp850_bin" , 0 , MYSQL_CHARSET_NAME_cp850 );
282
284
collation [81 ] = new Collation (81 , "cp852_bin" , 0 , MYSQL_CHARSET_NAME_cp852 );
283
285
collation [82 ] = new Collation (82 , "swe7_bin" , 0 , MYSQL_CHARSET_NAME_swe7 );
284
- collation [83 ] = new Collation (83 , " utf8_bin" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
286
+ collation [83 ] = new Collation (83 , new String [] { "utf8mb3_bin" , " utf8_bin" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
285
287
collation [84 ] = new Collation (84 , "big5_bin" , 0 , MYSQL_CHARSET_NAME_big5 );
286
288
collation [85 ] = new Collation (85 , "euckr_bin" , 0 , MYSQL_CHARSET_NAME_euckr );
287
289
collation [86 ] = new Collation (86 , "gb2312_bin" , 0 , MYSQL_CHARSET_NAME_gb2312 );
@@ -298,7 +300,7 @@ public class CharsetMapping {
298
300
collation [97 ] = new Collation (97 , "eucjpms_japanese_ci" , 1 , MYSQL_CHARSET_NAME_eucjpms );
299
301
collation [98 ] = new Collation (98 , "eucjpms_bin" , 0 , MYSQL_CHARSET_NAME_eucjpms );
300
302
collation [99 ] = new Collation (99 , "cp1250_polish_ci" , 0 , MYSQL_CHARSET_NAME_cp1250 );
301
-
303
+ // 100
302
304
collation [101 ] = new Collation (101 , "utf16_unicode_ci" , 0 , MYSQL_CHARSET_NAME_utf16 );
303
305
collation [102 ] = new Collation (102 , "utf16_icelandic_ci" , 0 , MYSQL_CHARSET_NAME_utf16 );
304
306
collation [103 ] = new Collation (103 , "utf16_latvian_ci" , 0 , MYSQL_CHARSET_NAME_utf16 );
@@ -323,7 +325,7 @@ public class CharsetMapping {
323
325
collation [122 ] = new Collation (122 , "utf16_croatian_ci" , 0 , MYSQL_CHARSET_NAME_utf16 );
324
326
collation [123 ] = new Collation (123 , "utf16_unicode_520_ci" , 0 , MYSQL_CHARSET_NAME_utf16 );
325
327
collation [124 ] = new Collation (124 , "utf16_vietnamese_ci" , 0 , MYSQL_CHARSET_NAME_utf16 );
326
-
328
+ // 125..127
327
329
collation [128 ] = new Collation (128 , "ucs2_unicode_ci" , 0 , MYSQL_CHARSET_NAME_ucs2 );
328
330
collation [129 ] = new Collation (129 , "ucs2_icelandic_ci" , 0 , MYSQL_CHARSET_NAME_ucs2 );
329
331
collation [130 ] = new Collation (130 , "ucs2_latvian_ci" , 0 , MYSQL_CHARSET_NAME_ucs2 );
@@ -348,7 +350,7 @@ public class CharsetMapping {
348
350
collation [149 ] = new Collation (149 , "ucs2_croatian_ci" , 0 , MYSQL_CHARSET_NAME_ucs2 );
349
351
collation [150 ] = new Collation (150 , "ucs2_unicode_520_ci" , 0 , MYSQL_CHARSET_NAME_ucs2 );
350
352
collation [151 ] = new Collation (151 , "ucs2_vietnamese_ci" , 0 , MYSQL_CHARSET_NAME_ucs2 );
351
-
353
+ // 152..158
352
354
collation [159 ] = new Collation (159 , "ucs2_general_mysql500_ci" , 0 , MYSQL_CHARSET_NAME_ucs2 );
353
355
collation [160 ] = new Collation (160 , "utf32_unicode_ci" , 0 , MYSQL_CHARSET_NAME_utf32 );
354
356
collation [161 ] = new Collation (161 , "utf32_icelandic_ci" , 0 , MYSQL_CHARSET_NAME_utf32 );
@@ -374,33 +376,33 @@ public class CharsetMapping {
374
376
collation [181 ] = new Collation (181 , "utf32_croatian_ci" , 0 , MYSQL_CHARSET_NAME_utf32 );
375
377
collation [182 ] = new Collation (182 , "utf32_unicode_520_ci" , 0 , MYSQL_CHARSET_NAME_utf32 );
376
378
collation [183 ] = new Collation (183 , "utf32_vietnamese_ci" , 0 , MYSQL_CHARSET_NAME_utf32 );
377
-
378
- collation [192 ] = new Collation (192 , " utf8_unicode_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
379
- collation [193 ] = new Collation (193 , " utf8_icelandic_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
380
- collation [194 ] = new Collation (194 , " utf8_latvian_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
381
- collation [195 ] = new Collation (195 , " utf8_romanian_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
382
- collation [196 ] = new Collation (196 , " utf8_slovenian_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
383
- collation [197 ] = new Collation (197 , " utf8_polish_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
384
- collation [198 ] = new Collation (198 , " utf8_estonian_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
385
- collation [199 ] = new Collation (199 , " utf8_spanish_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
386
- collation [200 ] = new Collation (200 , " utf8_swedish_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
387
- collation [201 ] = new Collation (201 , " utf8_turkish_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
388
- collation [202 ] = new Collation (202 , " utf8_czech_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
389
- collation [203 ] = new Collation (203 , " utf8_danish_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
390
- collation [204 ] = new Collation (204 , " utf8_lithuanian_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
391
- collation [205 ] = new Collation (205 , " utf8_slovak_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
392
- collation [206 ] = new Collation (206 , " utf8_spanish2_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
393
- collation [207 ] = new Collation (207 , " utf8_roman_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
394
- collation [208 ] = new Collation (208 , " utf8_persian_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
395
- collation [209 ] = new Collation (209 , " utf8_esperanto_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
396
- collation [210 ] = new Collation (210 , " utf8_hungarian_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
397
- collation [211 ] = new Collation (211 , " utf8_sinhala_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
398
- collation [212 ] = new Collation (212 , " utf8_german2_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
399
- collation [213 ] = new Collation (213 , " utf8_croatian_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
400
- collation [214 ] = new Collation (214 , " utf8_unicode_520_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
401
- collation [215 ] = new Collation (215 , " utf8_vietnamese_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
402
-
403
- collation [223 ] = new Collation (223 , " utf8_general_mysql500_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
379
+ // 184..191
380
+ collation [192 ] = new Collation (192 , new String [] { "utf8mb3_unicode_ci" , " utf8_unicode_ci" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
381
+ collation [193 ] = new Collation (193 , new String [] { "utf8mb3_icelandic_ci" , " utf8_icelandic_ci" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
382
+ collation [194 ] = new Collation (194 , new String [] { "utf8mb3_latvian_ci" , " utf8_latvian_ci" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
383
+ collation [195 ] = new Collation (195 , new String [] { "utf8mb3_romanian_ci" , " utf8_romanian_ci" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
384
+ collation [196 ] = new Collation (196 , new String [] { "utf8mb3_slovenian_ci" , " utf8_slovenian_ci" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
385
+ collation [197 ] = new Collation (197 , new String [] { "utf8mb3_polish_ci" , " utf8_polish_ci" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
386
+ collation [198 ] = new Collation (198 , new String [] { "utf8mb3_estonian_ci" , " utf8_estonian_ci" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
387
+ collation [199 ] = new Collation (199 , new String [] { "utf8mb3_spanish_ci" , " utf8_spanish_ci" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
388
+ collation [200 ] = new Collation (200 , new String [] { "utf8mb3_swedish_ci" , " utf8_swedish_ci" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
389
+ collation [201 ] = new Collation (201 , new String [] { "utf8mb3_turkish_ci" , " utf8_turkish_ci" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
390
+ collation [202 ] = new Collation (202 , new String [] { "utf8mb3_czech_ci" , " utf8_czech_ci" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
391
+ collation [203 ] = new Collation (203 , new String [] { "utf8mb3_danish_ci" , " utf8_danish_ci" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
392
+ collation [204 ] = new Collation (204 , new String [] { "utf8mb3_lithuanian_ci" , " utf8_lithuanian_ci" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
393
+ collation [205 ] = new Collation (205 , new String [] { "utf8mb3_slovak_ci" , " utf8_slovak_ci" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
394
+ collation [206 ] = new Collation (206 , new String [] { "utf8mb3_spanish2_ci" , " utf8_spanish2_ci" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
395
+ collation [207 ] = new Collation (207 , new String [] { "utf8mb3_roman_ci" , " utf8_roman_ci" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
396
+ collation [208 ] = new Collation (208 , new String [] { "utf8mb3_persian_ci" , " utf8_persian_ci" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
397
+ collation [209 ] = new Collation (209 , new String [] { "utf8mb3_esperanto_ci" , " utf8_esperanto_ci" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
398
+ collation [210 ] = new Collation (210 , new String [] { "utf8mb3_hungarian_ci" , " utf8_hungarian_ci" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
399
+ collation [211 ] = new Collation (211 , new String [] { "utf8mb3_sinhala_ci" , " utf8_sinhala_ci" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
400
+ collation [212 ] = new Collation (212 , new String [] { "utf8mb3_german2_ci" , " utf8_german2_ci" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
401
+ collation [213 ] = new Collation (213 , new String [] { "utf8mb3_croatian_ci" , " utf8_croatian_ci" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
402
+ collation [214 ] = new Collation (214 , new String [] { "utf8mb3_unicode_520_ci" , " utf8_unicode_520_ci" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
403
+ collation [215 ] = new Collation (215 , new String [] { "utf8mb3_vietnamese_ci" , " utf8_vietnamese_ci" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
404
+ // 216..222
405
+ collation [223 ] = new Collation (223 , new String [] { "utf8mb3_general_mysql500_ci" , " utf8_general_mysql500_ci" } , 0 , MYSQL_CHARSET_NAME_utf8mb3 );
404
406
collation [224 ] = new Collation (224 , "utf8mb4_unicode_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
405
407
collation [225 ] = new Collation (225 , "utf8mb4_icelandic_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
406
408
collation [226 ] = new Collation (226 , "utf8mb4_latvian_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
@@ -428,7 +430,7 @@ public class CharsetMapping {
428
430
collation [248 ] = new Collation (248 , "gb18030_chinese_ci" , 1 , MYSQL_CHARSET_NAME_gb18030 );
429
431
collation [249 ] = new Collation (249 , "gb18030_bin" , 0 , MYSQL_CHARSET_NAME_gb18030 );
430
432
collation [250 ] = new Collation (250 , "gb18030_unicode_520_ci" , 0 , MYSQL_CHARSET_NAME_gb18030 );
431
-
433
+ // 251..254
432
434
collation [255 ] = new Collation (255 , "utf8mb4_0900_ai_ci" , 1 , MYSQL_CHARSET_NAME_utf8mb4 );
433
435
collation [256 ] = new Collation (256 , "utf8mb4_de_pb_0900_ai_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
434
436
collation [257 ] = new Collation (257 , "utf8mb4_is_0900_ai_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
@@ -446,11 +448,11 @@ public class CharsetMapping {
446
448
collation [269 ] = new Collation (269 , "utf8mb4_sk_0900_ai_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
447
449
collation [270 ] = new Collation (270 , "utf8mb4_es_trad_0900_ai_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
448
450
collation [271 ] = new Collation (271 , "utf8mb4_la_0900_ai_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
449
-
451
+ // 272
450
452
collation [273 ] = new Collation (273 , "utf8mb4_eo_0900_ai_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
451
453
collation [274 ] = new Collation (274 , "utf8mb4_hu_0900_ai_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
452
454
collation [275 ] = new Collation (275 , "utf8mb4_hr_0900_ai_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
453
-
455
+ // 276
454
456
collation [277 ] = new Collation (277 , "utf8mb4_vi_0900_ai_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
455
457
collation [278 ] = new Collation (278 , "utf8mb4_0900_as_cs" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
456
458
collation [279 ] = new Collation (279 , "utf8mb4_de_pb_0900_as_cs" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
@@ -469,20 +471,34 @@ public class CharsetMapping {
469
471
collation [292 ] = new Collation (292 , "utf8mb4_sk_0900_as_cs" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
470
472
collation [293 ] = new Collation (293 , "utf8mb4_es_trad_0900_as_cs" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
471
473
collation [294 ] = new Collation (294 , "utf8mb4_la_0900_as_cs" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
472
-
474
+ // 295
473
475
collation [296 ] = new Collation (296 , "utf8mb4_eo_0900_as_cs" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
474
476
collation [297 ] = new Collation (297 , "utf8mb4_hu_0900_as_cs" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
475
477
collation [298 ] = new Collation (298 , "utf8mb4_hr_0900_as_cs" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
476
-
478
+ // 299
477
479
collation [300 ] = new Collation (300 , "utf8mb4_vi_0900_as_cs" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
478
-
480
+ // 301,302
479
481
collation [303 ] = new Collation (303 , "utf8mb4_ja_0900_as_cs" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
480
482
collation [304 ] = new Collation (304 , "utf8mb4_ja_0900_as_cs_ks" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
481
483
collation [305 ] = new Collation (305 , "utf8mb4_0900_as_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
482
484
collation [306 ] = new Collation (306 , "utf8mb4_ru_0900_ai_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
483
485
collation [307 ] = new Collation (307 , "utf8mb4_ru_0900_as_cs" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
484
486
collation [308 ] = new Collation (308 , "utf8mb4_zh_0900_as_cs" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
485
487
collation [309 ] = new Collation (309 , "utf8mb4_0900_bin" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
488
+ collation [310 ] = new Collation (310 , "utf8mb4_nb_0900_ai_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
489
+ collation [311 ] = new Collation (311 , "utf8mb4_nb_0900_as_cs" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
490
+ collation [312 ] = new Collation (312 , "utf8mb4_nn_0900_ai_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
491
+ collation [313 ] = new Collation (313 , "utf8mb4_nn_0900_as_cs" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
492
+ collation [314 ] = new Collation (314 , "utf8mb4_sr_latn_0900_ai_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
493
+ collation [315 ] = new Collation (315 , "utf8mb4_sr_latn_0900_as_cs" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
494
+ collation [316 ] = new Collation (316 , "utf8mb4_bs_0900_ai_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
495
+ collation [317 ] = new Collation (317 , "utf8mb4_bs_0900_as_cs" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
496
+ collation [318 ] = new Collation (318 , "utf8mb4_bg_0900_ai_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
497
+ collation [319 ] = new Collation (319 , "utf8mb4_bg_0900_as_cs" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
498
+ collation [320 ] = new Collation (320 , "utf8mb4_gl_0900_ai_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
499
+ collation [321 ] = new Collation (321 , "utf8mb4_gl_0900_as_cs" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
500
+ collation [322 ] = new Collation (322 , "utf8mb4_mn_cyrl_0900_ai_ci" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
501
+ collation [323 ] = new Collation (323 , "utf8mb4_mn_cyrl_0900_as_cs" , 0 , MYSQL_CHARSET_NAME_utf8mb4 );
486
502
487
503
COLLATION_INDEX_TO_COLLATION_NAME = new String [MAP_SIZE ];
488
504
Map <Integer , MysqlCharset > collationIndexToCharset = new TreeMap <>();
@@ -494,9 +510,11 @@ public class CharsetMapping {
494
510
for (int i = 1 ; i < MAP_SIZE ; i ++) {
495
511
Collation coll = collation [i ];
496
512
if (coll != null ) {
497
- COLLATION_INDEX_TO_COLLATION_NAME [i ] = coll .collationName ;
513
+ COLLATION_INDEX_TO_COLLATION_NAME [i ] = coll .collationNames [ 0 ] ;
498
514
collationIndexToCharset .put (i , coll .mysqlCharset );
499
- collationNameToCollationIndexMap .put (coll .collationName , i );
515
+ for (String collationName : coll .collationNames ) {
516
+ collationNameToCollationIndexMap .put (collationName , i );
517
+ }
500
518
String charsetName = coll .mysqlCharset .charsetName ;
501
519
502
520
if (!charsetNameToCollationIndexMap .containsKey (charsetName ) || charsetNameToCollationPriorityMap .get (charsetName ) < coll .priority ) {
@@ -769,13 +787,17 @@ String getMatchingJavaEncoding(String javaEncoding) {
769
787
770
788
class Collation {
771
789
public final int index ;
772
- public final String collationName ;
790
+ public final String [] collationNames ;
773
791
public final int priority ;
774
792
public final MysqlCharset mysqlCharset ;
775
793
776
794
public Collation (int index , String collationName , int priority , String charsetName ) {
795
+ this (index , new String [] { collationName }, priority , charsetName );
796
+ }
797
+
798
+ public Collation (int index , String [] collationNames , int priority , String charsetName ) {
777
799
this .index = index ;
778
- this .collationName = collationName ;
800
+ this .collationNames = collationNames ;
779
801
this .priority = priority ;
780
802
this .mysqlCharset = CharsetMapping .getStaticMysqlCharsetByName (charsetName );
781
803
}
@@ -786,8 +808,8 @@ public String toString() {
786
808
asString .append ("[" );
787
809
asString .append ("index=" );
788
810
asString .append (this .index );
789
- asString .append (",collationName =" );
790
- asString .append (this .collationName );
811
+ asString .append (",collationNames =" );
812
+ asString .append (Arrays . toString ( this .collationNames ) );
791
813
asString .append (",charsetName=" );
792
814
asString .append (this .mysqlCharset .charsetName );
793
815
asString .append (",javaCharsetName=" );
0 commit comments