Database - UTF-8 error
  • Many people seem to have gotten this error at some point in the proceedings:

    Unfortunately your postgresql database has not been created using a UTF-8 encoding.



    I can say for sure that if you just install a brand-new, clean, release version postgresql with default settings and turn it on, you will get this error, and none of the fixes I've seen on the net work.

    Go to a command line and enter the command pg_lsclusters.
    You will see output like the following:

    Version Cluster   Port Status Owner    Data directory                     Log file
    9.1     main      5432 online postgres /var/lib/postgresql/9.1/main       /var/log/postgresql/postgresql-9.1-main.log


    Now enter the following commands, using your version number instead of 9.1:

    pg_dropcluster --stop 9.1 main
    pg_createcluster --start -e UTF-8 9.1 main


    (Note that most commands I'm giving here need to be execcuted as root, or using sudo.)

    This variant works for a clean installation. Guarantee I give here but not for me it worked.
  • 3 Comments sorted by
  • The Postgres install - not UTF8 - aborts the install. The test is FLAWED.
    The installer checks if the POSTGRES database is is UTF8 if not it aborts the whole shebang. No amount of changing the locale to UTF8 will make any difference to the test.
    It doesn't matter if the postgres is UTF8. The Airtime can be forced to UTF8 independently.
    The standard advice to uninstall postgresql and reinstall doesn't work either because that does not remove the problem - when reinstalled it will keep the old encoding.
    -------------------------------------------------
    This rescues it:

    su root

    Reconfigure your local settings :

    dpkg-reconfigure locale

    Choose your locale (like for instance : en:US.UTF8)

    Uninstall and clean properly postgresql :

    apt-get --purge remove postgresql\*
    rm -r /etc/postgresql/
    rm -r /etc/postgresql-common/
    rm -r /var/lib/postgresql/
    userdel -r postgres
    groupdel postgres

    Re-install postgresql :

    aptitude install postgresql-9.1 postgresql-contrib-9.1 postgresql-doc-9.1

    Now any new database will be automatically be created with correct encoding, LC_TYPE (character classification), and LC_COLLATE (string sort order)
    Post edited by John Chewter at 2014-09-20 08:47:25
    No longer using Airtime or Libretime.
  • This is a very easy fix, what version of o/a are you useing
  • Add
    Me on skype I'll talk you through it Ecigwales thanks Nathan

    Many people seem to have gotten this error at some point in the proceedings:

    Unfortunately your postgresql database has not been created using a UTF-8 encoding.



    I can say for sure that if you just install a brand-new, clean, release version postgresql with default settings and turn it on, you will get this error, and none of the fixes I've seen on the net work.

    Go to a command line and enter the command pg_lsclusters.
    You will see output like the following:

    Version Cluster   Port Status Owner    Data directory                     Log file
    9.1     main      5432 online postgres /var/lib/postgresql/9.1/main       /var/log/postgresql/postgresql-9.1-main.log


    Now enter the following commands, using your version number instead of 9.1:

    pg_dropcluster --stop 9.1 main
    pg_createcluster --start -e UTF-8 9.1 main


    (Note that most commands I'm giving here need to be execcuted as root, or using sudo.)

    This variant works for a clean installation. Guarantee I give here but not for me it worked.