From: helge Date: Mon, 11 Apr 2005 20:06:53 +0000 (+0000) Subject: put connection into UTF-8 mode X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=037b9cd6f81580ba4ef1241fa252a3037bca4e30;p=sope put connection into UTF-8 mode git-svn-id: http://svn.opengroupware.org/SOPE/trunk@726 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-gdl1/MySQL4/MySQL4Channel.m b/sope-gdl1/MySQL4/MySQL4Channel.m index db1d80e8..a61889ee 100644 --- a/sope-gdl1/MySQL4/MySQL4Channel.m +++ b/sope-gdl1/MySQL4/MySQL4Channel.m @@ -163,13 +163,21 @@ static int openConnectionCount = 0; [socket cString], 0); if (rc == NULL) { - NSLog(@"WARNING: could not open MySQL4 connection to database '%@': %s", + NSLog(@"ERROR: could not open MySQL4 connection to database '%@': %s", [adaptor databaseName], mysql_error(self->_connection)); mysql_close(self->_connection); self->_connection = NULL; return NO; } + if (mysql_query(self->_connection, "SET CHARACTER SET utf8") != 0) { + NSLog(@"ERROR: could not put MySQL4 connection into UTF-8 mode: %s", + mysql_error(self->_connection)); + mysql_close(self->_connection); + self->_connection = NULL; + return NO; + } + if (isDebuggingEnabled) NSLog(@"MySQL4 connection established 0x%08X", self->_connection);