Re: How to have ant's task insert special chars appropriately?

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: How to have ant's task insert special chars appropriately?
Дата
Msg-id 4AB9EA5E.40307@archonet.com
обсуждение исходный текст
Ответ на How to have ant's task insert special chars appropriately?  (agostonbejo <bejoag1@yahoo.com>)
Ответы Re: How to have ant's task insert special chars appropriately?  ("J. Roeleveld" <joost@antarean.org>)
Re: How to have ant's task insert special chars appropriately?  (agostonbejo <bejoag1@yahoo.com>)
Список pgsql-general
agostonbejo wrote:
>
> 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.

Those aren't ASCII.

> 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.)
[snip]
> 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)?

There are three places you need to get this right:
1. The database encoding
2. The client encoding
3. The encoding of the contents of the .sql file

Now, since the database is UTF8 that means it can accept the entire
range of unicode characters, including all ISO-8859-1.

PostgreSQL can automatically convert from ISO-8859-1 to UTF-8 for you,
so it doesn't matter which you have in your .sql file.

What *does* matter is that you know what encoding your .sql file is
using and that you set the client encoding appropriately.

Since you're using Java, it's probably simplest just to use UTF-8 all
the way through. Crucially, make sure you know what the character-set of
the .sql file is - any good text editor should be able to tell you / set
 this.

--
  Richard Huxton
  Archonet Ltd

В списке pgsql-general по дате отправления:

Предыдущее
От: "Abraham, Danny"
Дата:
Сообщение: Re: PL/PG SQL: select count(*) into from where - does not compute the where cond
Следующее
От: "J. Roeleveld"
Дата:
Сообщение: Re: How to have ant's task insert special chars appropriately?