Skip to content

Commit 24fcf91

Browse files
committed
Rename utf8 and utf8mb4
* To reduce confusion (and create some, for those people not yet aware of the difference) I have renamed the utf8s to "UTF-8 Unicode BMP" resp. "UTF-8 Full Unicode" according to their supported character range. * Also *both* utf8 variants will now be at the top of the list when creating new tables/databases
1 parent 60a5d64 commit 24fcf91

3 files changed

Lines changed: 13 additions & 10 deletions

File tree

Interfaces/English.lproj/MainMenu.xib

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,7 +1412,7 @@
14121412
</object>
14131413
<object class="NSMenuItem" id="85590918">
14141414
<reference key="NSMenu" ref="315159986"/>
1415-
<string key="NSTitle">UTF-8 Unicode (utf8)</string>
1415+
<string key="NSTitle">UTF-8 Unicode BMP (utf8)</string>
14161416
<string key="NSKeyEquiv"/>
14171417
<int key="NSKeyEquivModMask">1048576</int>
14181418
<int key="NSMnemonicLoc">2147483647</int>
@@ -1422,7 +1422,7 @@
14221422
</object>
14231423
<object class="NSMenuItem" id="383065474">
14241424
<reference key="NSMenu" ref="315159986"/>
1425-
<string key="NSTitle">4-Byte UTF-8 Unicode (utf8mb4)</string>
1425+
<string key="NSTitle">UTF-8 Full Unicode (utf8mb4)</string>
14261426
<string key="NSKeyEquiv"/>
14271427
<int key="NSKeyEquivModMask">1048576</int>
14281428
<int key="NSMnemonicLoc">2147483647</int>

Interfaces/English.lproj/Preferences.xib

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@
640640
</object>
641641
<object class="NSMenuItem" id="658105746">
642642
<reference key="NSMenu" ref="1035849972"/>
643-
<string key="NSTitle">UTF-8 Unicode (utf8)</string>
643+
<string key="NSTitle">UTF-8 Unicode BMP (utf8)</string>
644644
<string key="NSKeyEquiv"/>
645645
<int key="NSKeyEquivModMask">1048576</int>
646646
<int key="NSMnemonicLoc">2147483647</int>
@@ -652,7 +652,7 @@
652652
</object>
653653
<object class="NSMenuItem" id="89605484">
654654
<reference key="NSMenu" ref="1035849972"/>
655-
<string key="NSTitle">4-Byte UTF-8 Unicode (utf8mb4)</string>
655+
<string key="NSTitle">UTF-8 Full Unicode (utf8mb4)</string>
656656
<string key="NSKeyEquiv"/>
657657
<int key="NSKeyEquivModMask">1048576</int>
658658
<int key="NSMnemonicLoc">2147483647</int>

Source/SPCharsetCollationHelper.m

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ - (void)refreshCharsets {
133133

134134
if (([encodings count] > 0) && [serverSupport supportsPost41CharacterSetHandling]) {
135135

136+
NSUInteger utf8encounters = 0;
137+
136138
for (NSDictionary *encoding in encodings)
137139
{
138140
NSString *charsetId = [encoding objectForKey:@"CHARACTER_SET_NAME"];
@@ -146,19 +148,20 @@ - (void)refreshCharsets {
146148
if(selectedCharset && [charsetId isEqualToString:selectedCharset])
147149
selectedRef = menuItem;
148150

149-
// If the UTF8 entry has been encountered, promote it to the top of the list
150-
if (promoteUTF8 && [charsetId isEqualToString:@"utf8"]) {
151-
[[charsetButton menu] insertItem:[menuItem autorelease] atIndex:0];
152-
//only add a separator if there actually are more items other than utf8 (might not be true for mysql forks)
153-
if([encodings count] > 1)
154-
[[charsetButton menu] insertItem:[NSMenuItem separatorItem] atIndex:1];
151+
// If an UTF8 entry has been encountered, promote it to the top of the list
152+
if (promoteUTF8 && [charsetId hasPrefix:@"utf8"]) {
153+
[[charsetButton menu] insertItem:[menuItem autorelease] atIndex:(utf8encounters++)];
155154
}
156155
else {
157156
[[charsetButton menu] addItem:[menuItem autorelease]];
158157
}
159158

160159
}
161160

161+
//only add a separator if there actually are more items other than utf8 (might not be true for mysql forks)
162+
if(utf8encounters && [encodings count] > utf8encounters)
163+
[[charsetButton menu] insertItem:[NSMenuItem separatorItem] atIndex:utf8encounters];
164+
162165
[charsetButton setEnabled:YES];
163166
}
164167

0 commit comments

Comments
 (0)