By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,178 Members | 971 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,178 IT Pros & Developers. It's quick & easy.

Converting SQL-ASCII encoding database to UNICODE

P: n/a

Hi ,

my current database in 7.3.4 is SQL_ASCII are there
any benifits of coverting it to UNICODE encoding
in 7.4 ? If so what is the process.

Regds
Mallah.
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Le Dimanche 9 Novembre 2003 19:39, Rajesh Kumar Mallah a écrit :
If so what is the process


The advantage of using a Unicode database is that UTF-8 supports/includes all
known encodings at once. Therefore, in the process of development, it can
help you save time.

When using a Unicode database, if the client does not support Unicode, it is
always possible to recode data streams on the fly with "set client_encoding =
foo_encoding". Therefore, there is no real drawback in using Unicode. It may
only be a little slower, but there is no real proof.

The process of conversion is as follows:

- dump the whole database using pg_dump:
pg_dump database_name > pg_data_dump.sql

- Do no drop the old database. Make a backup of the dump:
cp pg_data_dump.sql pg_data_dump.sql.bak

- recode the dump using the GNU recode package:
recode ..u8 pg_data_dump.sql

recode will try to guess the encoding the original ASCII database.

- Open the file in an UTF-8 editor like Kate and verify that all characters
are preserved and display well (in Hindi?). If it does not work, it may be a
problem of original encoding. Try to guess it and retry using:

cp -f source_encoding..u8.bak source_encoding..u8
recode source_encoding..u8 pg_data_dump.sql

- create an empty Unicode database:
psql template1
create database new_database with encoding=Unicode;
reload the dump: psql new_database < pg_data_dump.sql

GNU/recode is available in most GNU/Linux distributions.

By the way, as you live in India, do not hesitate to visit
http://pgadmin.postgresql.org/pgadmin3/translation.php if you can help us.

Most translations in languages for India are "stalled", do not hesitate to
take over the translation in Hindi for example.

Cheers,
Jean-Michel
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.