CVS update: gnucash

Andreas Bogk andreas@andreas.org
17 Apr 2002 10:47:23 +0000


Dave Peticolas <dave@krondo.com> writes:

> > Security advice: the glibc thinks ASCII is called "ANSI_X3.4-1968",
> > while PostgreSQL thinks the proper name of ASCII is "SQL_ASCII".
> Do you have a fix for this?

Here's a workaround.  A real solution would involve getting the glibc
and PostgreSQL maintainers to agree upon the names of character sets,
or just talking UTF-8 to PostgreSQL and handling character set
conversion internally.

BTW: is it just me, or is there no such thing as a common standard for
character set names?

Andreas

--- src/backend/postgres/PostgresBackend.c~  Mon Apr  8 20:28:52 2002
+++ src/backend/postgres/PostgresBackend.c   Wed Apr 17 09:59:01 2002
@@ -1925,13 +1925,17 @@
 
       if (FALSE == db_exists)
       {
+       char* encoding = nl_langinfo(CODESET);
+
+       if (!strcmp (encoding, "ANSI_X3.4-1968"))
+         encoding = "SQL_ASCII";
 
          /* create the database */
          p = be->buff; *p =0;
          p = stpcpy (p, "CREATE DATABASE ");
          p = stpcpy (p, be->dbName);
          p = stpcpy (p, " WITH ENCODING = '");
-        p = stpcpy (p, nl_langinfo(CODESET));
+        p = stpcpy (p, encoding);
          p = stpcpy (p, "';");
          SEND_QUERY (be,be->buff, );
          FINISH_QUERY(be->connection);