aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Conversion.m
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2017-05-02 01:14:27 +0200
committerMax <post@wickenrode.com>2017-05-02 01:14:27 +0200
commitfac661c5d1dcac7780521facdaebdc6f4c1afa27 (patch)
treead0468669f054f84a00da9dfb4943cd117976b13 /Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Conversion.m
parent2b081c2ef732599a035dc05ff33b08edffd74b04 (diff)
downloadsequelpro-fac661c5d1dcac7780521facdaebdc6f4c1afa27.tar.gz
sequelpro-fac661c5d1dcac7780521facdaebdc6f4c1afa27.tar.bz2
sequelpro-fac661c5d1dcac7780521facdaebdc6f4c1afa27.zip
Fix some issues with charset handling during connect
* hostname and file paths are places where libmysqlclient ultimately only passes the string to an OS library so we should use whatever charset the OS expects, not mysql * Even though _makeRawMySQLConnectionWithEncoding:isMasterConnection: takes an explicit charset argument most of the conversion logic simply used whatever charset the existing connection currently has, which is not neccesarily the one the new connection should use * Add some remarks about the charset handling with passwords and mysql_error() * Charsets do not apply to sqlstate.
Diffstat (limited to 'Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Conversion.m')
-rw-r--r--Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Conversion.m14
1 files changed, 9 insertions, 5 deletions
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Conversion.m b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Conversion.m
index 676684ca..a7d293ea 100644
--- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Conversion.m
+++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Conversion.m
@@ -79,7 +79,7 @@
}
/**
- * Converts a C string to an NSString using the supplied encoding.
+ * Converts a C string to an NSString using the current connection encoding.
* This method *will not* correctly preserve nul characters within c strings; instead
* the first nul character within the string will be treated as the line ending. This
* is unavoidable without supplying a string length, so this method should not be widely
@@ -87,11 +87,15 @@
*/
- (NSString *)_stringForCString:(const char *)cString
{
+ return _stringForCStringWithEncoding(cString, stringEncoding);
+}
- // Don't try and convert null strings
- if (cString == NULL) return nil;
-
- return [NSString stringWithCString:cString encoding:stringEncoding];
+/**
+ * @see _stringForCStringWithEncoding()
+ */
++ (NSString *)_stringForCString:(const char *)cString usingEncoding:(NSStringEncoding)encoding
+{
+ return _stringForCStringWithEncoding(cString, encoding);
}
@end