Hi,
here's a patch for that issue.
I patched examples, doc, but NOT mock tests.

Regards,
Jérémy.



--- a/doc/dbconfig-common.sgml
+++ b/doc/dbconfig-common.sgml
@@ -511,6 +511,10 @@
 				<item>specifies encoding for created
 				postgres databases (defaults to:
 				empty/system default)
+			<tag>dbc_mysql_createdb_encoding (used in: <var>postinst</var>)
+				<item>specifies encoding for created
+				mysql databases (defaults to:
+				empty/system default)
 			<tag>dbc_sql_substitutions (used in: <var>postinst</var>, 
 			                            sometimes <var>postrm</var>)
 				<item>if nonempty, specifies that
--- a/internal/mysql
+++ b/internal/mysql
@@ -171,7 +171,10 @@
 	if _dbc_mysql_check_database "$dbc_dbname"; then
 		dbc_logline "already exists"
 	else
-		_dbc_nodb="yes" dbc_mysql_exec_command "CREATE DATABASE $dbc_dbname"
+		if [ "${dbc_mysql_createdb_encoding:-}" ]; then
+			extrasql=" CHARACTER SET '$dbc_mysql_createdb_encoding'"; 
+		fi
+		_dbc_nodb="yes" dbc_mysql_exec_command "CREATE DATABASE $dbc_dbname${extrasql:-}"
 		ret=$?
 		_dbc_nodb=""
 		if [ "$ret" = "0" ]; then
--- a/examples/db-test-mysql-2.0/debian/postinst
+++ b/examples/db-test-mysql-2.0/debian/postinst
@@ -4,7 +4,10 @@
 #set -x
 
 . /usr/share/debconf/confmodule
-. /usr/share/dbconfig-common/dpkg/postinst.mysql 
+. /usr/share/dbconfig-common/dpkg/postinst.mysql
+
+# you can set the default database encoding to something else
+dbc_mysql_createdb_encoding="UTF8"
 dbc_generate_include=php:/etc/db-test-mysql/debian-db.php
 dbc_go db-test-mysql $@
 

Reply via email to