0

pg_dumpコマンドを使用して作成された圧縮.dmpファイルのエンコーディングを変更する必要がありました。現在、私はダンプファイルのみを持っており、データベース全体は持っていません。別のエンコーディングに準拠するようにファイルを変更するにはどうすればよいですか?win1252からlatin1に移行したいと思います。Linuxマシンでiconvを使用すると、win1252はサポートされていないことがわかります。

4

1 に答える 1

2

A .dmp file from Postgres is a regular plain text file so you should be able to use e.g. iconv. Say you wanted to switch from UTF-8 to LATIN1, you could do:

iconv -f utf-8 -t latin1 <infile >outfile

Please note though that this will only change the encoding of the characters. If you need to change the DDL that is used to create the tables, columns etc, you will need to modify the file manually. Or import it, make the changes and then export again.

于 2013-02-19T19:10:15.160 に答える