How to change the file encoding of a 3gb file?

Started by Andre Lopesover 15 years ago5 messagesgeneral
Jump to latest
#1Andre Lopes
lopes80andre@gmail.com

Hi,

I'am trying to import an SQL file with 3gb of INSERTS. I must to change the
encode of the file to UTF8, how can I change the encode of the file without
open it? This 3gb file crashes every program...

Give me a clue.

Best Regards,

#2Noname
manitou-sig@sd-9404.dedibox.fr
In reply to: Andre Lopes (#1)
Re: How to change the file encoding of a 3gb file?

Andre Lopes wrote:

I'am trying to import an SQL file with 3gb of INSERTS. I must to change the
encode of the file to UTF8, how can I change the encode of the file without
open it? This 3gb file crashes every program...

Give me a clue.

I'd use recode: http://recode.progiciels-bpi.ca/index.html
It can recode large files without needing much memory.

Best regards,
--
Daniel
PostgreSQL-powered mail user agent and storage: http://www.manitou-mail.org

#3Scott Marlowe
scott.marlowe@gmail.com
In reply to: Andre Lopes (#1)
Re: How to change the file encoding of a 3gb file?

On Sun, Jul 18, 2010 at 3:51 PM, Andre Lopes <lopes80andre@gmail.com> wrote:

Hi,

I'am trying to import an SQL file with 3gb of INSERTS. I must to change the
encode of the file to UTF8, how can I change the encode of the file without
open it? This 3gb file crashes every program...

Has iconv been any help?

#4zhong ming wu
mr.z.m.wu@gmail.com
In reply to: Andre Lopes (#1)
Re: How to change the file encoding of a 3gb file?

Will running the following on your file useful

http://www.gnu.org/software/recode/

It helped me with a pg_dump file in the past

Show quoted text

On Sun, Jul 18, 2010 at 5:51 PM, Andre Lopes <lopes80andre@gmail.com> wrote:

Hi,

I'am trying to import an SQL file with 3gb of INSERTS. I must to change the
encode of the file to UTF8, how can I change the encode of the file without
open it? This 3gb file crashes every program...

Give me a clue.

Best Regards,

#5Sergey Konoplev
gray.ru@gmail.com
In reply to: Andre Lopes (#1)
Re: How to change the file encoding of a 3gb file?

Hi,

I'm just guessing.

If you have a database in UTF8 and your SQL-file in some encoding so
what about doing this:

1. Connect to your database using psql
$ psql -p ... -h ... -U ... your_database

2. Set client encoding to the encoding of your SQL-file
yourdb=# \encoding your_sql_encoding

3. Load the SQL-file
\i your_sql_file

On 19 July 2010 01:51, Andre Lopes <lopes80andre@gmail.com> wrote:

Hi,

I'am trying to import an SQL file with 3gb of INSERTS. I must to change the
encode of the file to UTF8, how can I change the encode of the file without
open it? This 3gb file crashes every program...

Give me a clue.

Best Regards,

--
Sergey Konoplev

Blog: http://gray-hemp.blogspot.com /
Linkedin: http://ru.linkedin.com/in/grayhemp /
JID/GTalk: gray.ru@gmail.com / Skype: gray-hemp / ICQ: 29353802