Skip to content

Commit c12d5bc

Browse files
authored
charsert: make collation case insensitive (pingcap#66)
1 parent 732d073 commit c12d5bc

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

charset/charset.go

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ func ValidCharsetAndCollation(cs string, co string) bool {
9494
if co == "" {
9595
return true
9696
}
97+
co = strings.ToLower(co)
9798
_, ok = c.Collations[co]
9899
if !ok {
99100
return false

charset/charset_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ func (s *testCharsetSuite) TestValidCharset(c *C) {
4949
{"utf8", "utf8_invalid_ci", false},
5050
{"utf16", "utf16_bin", false},
5151
{"gb2312", "gb2312_chinese_ci", false},
52+
{"UTF8", "UTF8_BIN", true},
53+
{"UTF8", "utf8_bin", true},
54+
{"UTF8MB4", "utf8mb4_bin", true},
55+
{"UTF8MB4", "UTF8MB4_bin", true},
56+
{"UTF8MB4", "UTF8MB4_general_ci", true},
57+
{"Utf8", "uTf8_bIN", true},
5258
}
5359
for _, tt := range tests {
5460
testValidCharset(c, tt.cs, tt.co, tt.succ)

0 commit comments

Comments
 (0)