Skip to content

Instantly share code, notes, and snippets.

@rnstux
Created July 2, 2021 13:36
Show Gist options
  • Save rnstux/7995aac639d14e3b01a6e523e44fb806 to your computer and use it in GitHub Desktop.
Save rnstux/7995aac639d14e3b01a6e523e44fb806 to your computer and use it in GitHub Desktop.
Convertir a UTF 8
pg_dump -U postgres "$1" > "$1"_dump.sql
cat "$1"_dump.sql | recode iso-8859-1..u8 > "$1"_dump_utf8.sql
perl -pi -w -e 's/SQL_ASCII/UTF8/g;' "$1"_dump_utf8.sql
dropdb -U postgres "$1"
createdb -U postgres --template=template0 "$1"
psql -U postgres "$1" < "$1"_dump_utf8.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment