psql_ascii_2_utf8
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
psql_ascii_2_utf8 [2014/10/20 14:42] – sweitmann | psql_ascii_2_utf8 [2014/12/30 15:01] – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
===== Convert PostgreSQL database from SQL_ASCII to UTF8 ===== | ===== 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: | ||
- | You should now get the following output: | ||
UTF8_database_dump.sql: | UTF8_database_dump.sql: | ||
- | |||
Now open the new UTF8_database_dump.sql file with your favourite editor and change the line: | Now open the new UTF8_database_dump.sql file with your favourite editor and change the line: | ||
SET client_encoding = ' | SET client_encoding = ' | ||
Line 29: | Line 27: | ||
SET client_encoding = ' | SET client_encoding = ' | ||
Create a new database: | Create a new database: | ||
- | createdb | + | createdb |
And import the UTF8_database_dump.sql | And import the UTF8_database_dump.sql | ||
- | psql UTF8_database_name | + | psql new_UTF8_database_name |
That's it! | That's it! | ||
psql_ascii_2_utf8.txt · Last modified: 2023/02/20 14:52 by sweitmann