please make the tables default encoding utf8_general_ci

Comments

agentrickard’s picture

Is that what the following comment line in the install file does?

/*!40100 DEFAULT CHARACTER SET UTF8 */

I had that in previous versions but took it out.

And how does pgSQL handle it?

Pointers to samples are acceptable; as are patches.

dsp1’s picture

yes, that is what that does.

not sure how pgSQL handles it, but many modules have this. so it should be ok.

agentrickard’s picture

Yea, I see it in system.install.

I removed it, incorrectly, when I was cleaning up the code for the install file to add pgsql support.

I'll put in back shortly. Will be at OSCMS rest of week.

agentrickard’s picture

Category: feature » bug
Status: Active » Closed (fixed)

Fixed in HEAD, 5.x.1-dev, and 4.7.x.3-dev.

If you installed v 4.7.x.3.9 or 5.x.1.10, you may need to run update.php.

This bug does not affect pgSQL. See system.install:

function system_update_169() {
  // Warn PGSQL admins if their database is set up incorrectly
  if ($GLOBALS['db_type'] == 'pgsql') {
    $encoding = db_result(db_query('SHOW server_encoding'));
    if (!in_array(strtolower($encoding), array('unicode', 'utf8'))) {
      $msg = 'Your PostgreSQL database is set up with the wrong character encoding ('. $encoding .'). It is possible it will not work as expected. It is advised to recreate it with UTF-8/Unicode encoding. More information can be found in the <a href="http://www.postgresql.org/docs/7.4/interactive/multibyte.html">PostgreSQL documentation</a>.';
      watchdog('php', $msg, WATCHDOG_WARNING);
      drupal_set_message($msg, 'status');
    }
  }
agentrickard’s picture

Status: Closed (fixed) » Fixed

This may need follow-up, as I used the following update syntax, which may be overkill.

$sql ="ALTER TABLE {mysite} DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci";

Reading http://drupal.org/node/22218#utf8_sql and http://api.drupal.org/api/5/function/update_convert_table_utf8 suggests that this is incorrect.

I will recommit the update function as:

  return _system_update_utf8(array('table1', 'table2', 'table3'));
agentrickard’s picture

Status: Fixed » Closed (fixed)