From be01aff987f05191fb1a244482fa1b3ff9c6bccb Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Thu, 29 Mar 2012 00:01:44 +0000 Subject: - 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. --- Source/SPTableData.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Source') 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"]; } -- cgit v1.2.3