Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm exporting my postgresql db using the command

su - postgres -c "pg_dump --inserts --column-inserts mydb" > export.sql

But when I open the exported file with vi, the letter with accents are not being displayed correctly, however the web app that reads data from this DB does show them ok.

Any hints ? Thanks.

share|improve this question

1 Answer 1

It can either be due to

  • Your vi is not configured to support UTF-8 characters, try to add set fileencodings=utf-8,latin1 to your vimrc
  • Your pg_dump is not dumping as UTF-8, you can force it to do so by adding -E UTF8 to your pg_dump options
share|improve this answer
    
Thanks for your reply. I did both: 1) created a .vimrc under /root with the fileecodings entry and 2) added the --encoding=UTF8 option and exported but no luck. Any other hints? –  xain Jan 20 '11 at 11:28
    
If you did both it should be okay, it's still showing weird characters? If so have you tried restoring the DB just to check? –  lynxman Jan 20 '11 at 11:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.