diff --git a/debian/patches/05-db-encoding.patch b/debian/patches/05-db-encoding.patch new file mode 100644 index 00000000000..ad9b0530c2a --- /dev/null +++ b/debian/patches/05-db-encoding.patch @@ -0,0 +1,33 @@ +Author: Timothy E. Harris +Description: + Fix bug that prevents creating a new database if the locale is not a UTF-8 one + (Closes: #584976). + +diff -Naurp openerp-server.orig/bin/service/web_services.py openerp-server/bin/service/web_services.py +--- openerp-server.orig/bin/service/web_services.py 2010-03-30 11:24:21.000000000 +0000 ++++ openerp-server/bin/service/web_services.py 2010-06-08 09:39:10.000000000 +0000 +@@ -38,6 +38,7 @@ import release + import sql_db + import tools + import locale ++import re + from cStringIO import StringIO + + logging.basicConfig() +@@ -64,11 +65,15 @@ class db(netsvc.Service): + self._pg_psw_env_var_is_set = False # on win32, pg_dump need the PGPASSWORD env var + + def _create_empty_database(self, name): ++ if re.search('utf|UTF', locale.getdefaultlocale()[1]): ++ db_encoding = 'unicode' ++ else: ++ db_encoding = 'LATIN1' + db = sql_db.db_connect('template1') + cr = db.cursor() + try: + cr.autocommit(True) # avoid transaction block +- cr.execute("""CREATE DATABASE "%s" ENCODING 'unicode' TEMPLATE "template0" """ % name) ++ cr.execute("""CREATE DATABASE "%s" ENCODING '%s' TEMPLATE "template0" """ %(name, db_encoding)) + finally: + cr.close() + diff --git a/debian/patches/series b/debian/patches/series index 7819b4cf731..78bdb14b64f 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -2,3 +2,4 @@ 02-migrate.patch 03-shebang.patch 04-manpage.patch +05-db-encoding.patch