static function charset($charset = 'utf8')
{
// check if there is a assigned charset and compare it
if (self::$charset == $charset) {
return true;
}
// set the new charset
$set = @mysql_query('SET NAMES ' . $charset);
if (!$set) {
return self::error(l::get('db.errors.setting_charset_failed', 'Setting database charset failed'));
}
// save the new charset to the globals
self::$charset = $charset;
return $charset;
}