Forum OpenACS Development: Response to PostgreSQL upper() / lower() functions and LATIN2 charset


I've been trying to get nsd8x with iso-8859-1 character set running. I've tried Henry Minsky's patches, read Henry's ASJ document, Rob Mayoff's encoding document, but with no sucess.

I'm including a short description of my system configuration. Could anybody with a working configuration please post a description of his configuration (dabatase encoding, how they compiled PostgreSQL, system encoding...)

  1. nsd.tcl file:
        ns_param   HackContentType   true
        ns_param   OutputCharset     iso-8859-1
        ns_param   PreferredCharsets iso-8859-1
        ns_param   URLCharset        iso-8859-1
  2. System encoding (as read in /usr/local/aolserver/modules/tcl/init.tcl)
        encoding system utf-8 (but i've also tried with iso8859-1)
  3. Database:
        Compiled with:
        $ ./configure --enable-locale --enable-multibyte=UNICODE --enable-unicode-conversion
        $ createdb -E UNICODE legolasdb
        $ psql -l
                List of databases
         Database  |  Owner   | Encoding
         legolasdb | nsadmin  | UNICODE
  4. form.tcl
        set page "<form method=get action=form-2.tcl>
        <input type=text name=test>
        <input type=hidden name=_charset value=iso-8859-1>
        <input type=submit>
        ReturnHeaders "text/html; charset=iso-8859-1"
        ns_startcontent -type text/html
        ns_write $page
  5. form-2.tcl
        # I've tried these three:
        ns_formfieldcharset _charset
        # ns_urlcharset iso-8859-1
        # ns_setformencoding iso-8859-1
        set form [ns_getform]
        set test [ns_set get $form test]
        set db [ns_db gethandle]
        ns_db dml $db "insert into encoding (id, test)
          values (nextval('encoding_id_seq'), '$test')"
  6. Now, if i do a select id, test, upper(test) as upper, lower(test) as lower from encoding i get:
    id - test - upper - lower
    47 áéíóú   áéíóú   ã¡ã©ã­ã³ãº
  7. And i thinks it's not a PostgreSQL issue, because in psql i can do:
    legolasdb=# show client_encoding;
    NOTICE:  Current client encoding is UNICODE
    legolasdb=# insert into zzz_encoding (id, test)
    legolasdb-#     values (nextval('zzz_encoding_id_seq'), 'áÃ?íÃ?ú');
    INSERT 184598 1
    legolasdb=# select id, test, upper(test), lower(test) from zzz_encoding;
    id |   test     |   upper    |   lower
    48 | áÃ?íÃ?ú      | Ã?Ã?Ã?Ã?Ãs      | áéíóú
I'm using aolserver3_2_ad12 (with and without Henry's patches), and PostgreSQL 7.1rc4.

I'd be really grateful if someone could post his working configuration. Thanks in advance!