User Tools

Site Tools


psql_ascii_2_utf8

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
psql_ascii_2_utf8 [2014/10/20 14:42] sweitmannpsql_ascii_2_utf8 [2014/10/20 15:19] sweitmann
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 "root" and install the Recode tool. In Linux Debian you do this by typing:+Login to your server as "root" and install the 'Recodetool. In Linux Debian you do this by typing:
      apt-get install recode      apt-get install recode
 Then switch to the "postgres" account: Then switch to the "postgres" account:
Line 20: Line 20:
  
     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: UTF-8 Unicode text     UTF8_database_dump.sql: UTF-8 Unicode text
- 
 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 = 'SQL_ASCII';     SET client_encoding = 'SQL_ASCII';
Line 29: Line 28:
     SET client_encoding = 'UTF8';     SET client_encoding = 'UTF8';
 Create a new database: Create a new database:
-    createdb UTF8_database_name+    createdb new_UTF8_database_name
 And import the UTF8_database_dump.sql And import the UTF8_database_dump.sql
-    psql UTF8_database_name < UTF8_database_dump.sql+    psql new_UTF8_database_name < UTF8_database_dump.sql
 That's it!    That's it!   
    
psql_ascii_2_utf8.txt · Last modified: 2023/02/20 14:52 by sweitmann