psql_ascii_2_utf8
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
psql_ascii_2_utf8 [2014/10/20 14:34] – created sweitmann | psql_ascii_2_utf8 [2014/12/30 15:01] – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Software packages | + | ===== Convert PostgreSQL database from SQL_ASCII to UTF8 ===== |
- | Login to your server as " | + | Login to your server as " |
| | ||
Then switch to the " | Then switch to the " | ||
su postgres | su postgres | ||
- | Now create | + | Now start by creating |
| | ||
Line 11: | Line 11: | ||
file SQL_ASCII_database_dump.sql | file SQL_ASCII_database_dump.sql | ||
- | You should get the following output: | + | You should get the following output: |
- | + | ||
SQL_ASCII_database_dump.sql: | SQL_ASCII_database_dump.sql: | ||
Then you convert your ISO-8859 file to UTF8 by typing: | Then you convert your ISO-8859 file to UTF8 by typing: | ||
Line 20: | Line 19: | ||
file UTF8_database_dump.sql | file UTF8_database_dump.sql | ||
+ | You should now get the following output: | ||
+ | |||
+ | UTF8_database_dump.sql: | ||
+ | Now open the new UTF8_database_dump.sql file with your favourite editor and change the line: | ||
+ | SET client_encoding = ' | ||
+ | to: | ||
+ | SET client_encoding = ' | ||
+ | Create a new database: | ||
+ | createdb new_UTF8_database_name | ||
+ | And import the UTF8_database_dump.sql | ||
+ | psql new_UTF8_database_name < UTF8_database_dump.sql | ||
+ | That's it! | ||
+ | |||
psql_ascii_2_utf8.txt · Last modified: 2023/02/20 14:52 by sweitmann