Skip to content

Instantly share code, notes, and snippets.

@zenith6
Created February 1, 2014 03:46
Show Gist options
  • Select an option

  • Save zenith6/8747664 to your computer and use it in GitHub Desktop.

Select an option

Save zenith6/8747664 to your computer and use it in GitHub Desktop.
EC-CUBEに対して、DB接続の文字エンコーディングをDSNで指定するパッチです。
Index: data/class/db/SC_DB_DBFactory.php
===================================================================
--- data/class/db/SC_DB_DBFactory.php (リビジョン 23329)
+++ data/class/db/SC_DB_DBFactory.php (作業コピー)
@@ -70,7 +70,8 @@
'protocol' => 'tcp',
'hostspec' => DB_SERVER,
'port' => DB_PORT,
- 'database' => DB_NAME
+ 'database' => DB_NAME,
+ 'charset' => 'utf8',
);
} else {
return '';
Index: data/class/SC_Query.php
===================================================================
--- data/class/SC_Query.php (リビジョン 23329)
+++ data/class/SC_Query.php (作業コピー)
@@ -57,7 +57,8 @@
'protocol' => 'tcp',
'hostspec' => DB_SERVER,
'port' => DB_PORT,
- 'database' => DB_NAME
+ 'database' => DB_NAME,
+ 'charset' => 'utf8',
);
}
@@ -79,7 +80,6 @@
$this->conn = MDB2::singleton($dsn, $options);
}
if (!PEAR::isError($this->conn)) {
- $this->conn->setCharset('utf8');
$this->conn->setFetchMode(MDB2_FETCHMODE_ASSOC);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment