How to have ant's task insert special chars appropriately? - Mailing list pgsql-general

From agostonbejo
Subject How to have ant's task insert special chars appropriately?
Date
Msg-id 25530663.post@talk.nabble.com
Whole thread Raw
Responses Re: How to have ant's task insert special chars appropriately?  (Richard Huxton <dev@archonet.com>)
List pgsql-general

Hi!

What I'm trying to do is to insert some data from a sql file into a postgres
DB by calling the <sql> ant task. My problem is that I can't get special
characters (even if they can be represented by the standard ASCII charset,
such as ä, ö, ü, é, etc.) to be inserted correctly.

When I check the DB with a DB browser such as Squirrel or pgAdmin, after
running the <sql> task they can only see question marks where these
characters are supposed to be. So does the actual web application using the
DB. (The web app can store and read such special characters seamlessly,
though. It's also OK if I enter some of them by hand with the DB browsers
mentioned above.)

This all suggests that the problem is with the way I call the <sql> task.
I've tried several versions: inserting from a sql file with iso-8859-1
encoding, then from one with utf-8 encoding. (In pgAdmin I can see the
default encoding of the DB is utf-8.)

Something like this:

<sql
    encoding="ISO-8859-1"
    classpath="${db.pg.classpath}"
    driver="${db.pg.driver}"
    url="${db.pg.connection}/${db.database.name}"
    userid="${db.schema.owner.name}"
    password="${db.schema.owner.pwd}"
    src="${sql.pg.dir}/update/testdata.sql"
/>

(This works perfectly as long as there are no special characters.)

I tried changing the "encoding" attribute above to UTF-8, adding "SET
client_encoding = 'UTF8';" to the UTF-8 file, then to the iso-8859-1 file;
"SET client_encoding = 'LATIN1';" to the iso-8859-1 file (this latter in
addition produced the error "The server's client_encoding parameter was
changed to LATIN1. The JDBC driver requires client_encoding to be UNICODE
for correct operation.")

Does anyone have any idea how to get those special characters loaded into
the DB from a pre-written sql file (possibly with the ant <sql> task)?


Thanks,
Agoston
--
View this message in context:
http://www.nabble.com/How-to-have-ant%27s-%3Csql%3E-task-insert-special-chars-appropriately--tp25530663p25530663.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


pgsql-general by date:

Previous
From: Bill Moran
Date:
Subject: Re: VMWare file system / database corruption
Next
From: Emanuel Calvo Franco
Date:
Subject: Re: citext like query and index usage