aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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"];
}