aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2012-03-29 00:01:44 +0000
committerrowanbeentje <rowan@beent.je>2012-03-29 00:01:44 +0000
commitbe01aff987f05191fb1a244482fa1b3ff9c6bccb (patch)
treea446cd4e7f753e839a01b4bb01165b9bc3892229 /Source
parenta0aadbfc6fdd7f80bd6a74457094443b9ceeedeb (diff)
downloadsequelpro-be01aff987f05191fb1a244482fa1b3ff9c6bccb.tar.gz
sequelpro-be01aff987f05191fb1a244482fa1b3ff9c6bccb.tar.bz2
sequelpro-be01aff987f05191fb1a244482fa1b3ff9c6bccb.zip
- If no table encoding is set on a table, fall back to the database encoding if available, instead of directly to Latin1. This improves compatibility with MySQL <4.1 servers set to use an encoding other than latin1, and fixes incorrect encoding detection where tables are set to inherit from the database. This should address Issue #1308.
Diffstat (limited to 'Source')
-rw-r--r--Source/SPTableData.m5
1 files changed, 4 insertions, 1 deletions
diff --git a/Source/SPTableData.m b/Source/SPTableData.m
index 262b2d3c..f7bbeec2 100644
--- a/Source/SPTableData.m
+++ b/Source/SPTableData.m
@@ -773,7 +773,10 @@
encodingString = [[NSString alloc] initWithString:[createTableParser substringWithRange:NSMakeRange(stringStart, i-stringStart)]];
}
- // If no DEFAULT CHARSET is present, it's likely MySQL < 4; fall back to latin1.
+ // If no DEFAULT CHARSET is present, fall back to either the database encoding (works back to MySQL 3),
+ // or if no document is available to supply the database encoding, Latin1.
+ } else if ([tableDocumentInstance databaseEncoding]) {
+ encodingString = [[NSString alloc] initWithString:[tableDocumentInstance databaseEncoding]];
} else {
encodingString = [[NSString alloc] initWithString:@"latin1"];
}