
When writing on a longer blog entry yesterday (it's not ready, yet) I thought I might give updating Serendipity a try. And while I was at it, I wanted to get rid of MySQL on the poor Server with only 256MB RAM. As I need the PostgreSQL that's also running there and free tells number like:
total used free shared buffers cached
Mem: 256620 248852 7768 0 0 61544
-/+ buffers/cache: 187308 69312
Swap: 489940 217300 272640
I thought it would be a good idea.
So I did a mysqldump of the data and a second installation of serendipity 0.8.1 but with a PostgreSQL DB. But then the problems started because of the encodings. The PostgreSQL DB was in UTF-8 while the MySQL dump apparently was in UTF-8 as well. But doing a "\i data.sql" in psql only gave me errors of unknown Unicode sequences.
So I tried all combinations: "SET NAMES 'LATIN1'" in psql and import again. Nothing. "mysqldump --default-character-set=latin1". Import as latin1, or unicode. Sometimes the import would work, but then I would get to see unicode sequences in the serendipity output.
In the end I realized that the problem was not the import or export but serendipity. It fetched the text as unicode from the DB and didn't make sure to convert to the encoding it told the webbrowser the text was in. As 0.8.1 didn't have support for UTF-8 from the central configuration I just changed the LANG_CHARSET in the relevant files to "UTF-8" and everything worked as expected.
The update from 0.8.1 to 0.9.1 was painless and now the UTF-8 setting could be set from the admin pages. The last hurdle was to rename the serendipity directory as I wasn't working on the main blog site. Changing the paths in the serendipity configuration was not enough. I had to manually change a .htaccess file and do two updates to the DB for plugins that also saved the complete path in their config.
Now I have a shiny Serendipity 0.9.1 using PostgreSQL, ready for more blog entries to steal your time
UPDATE: Well, one more problem: The sequences for the primary keys were all at 1. So I had to set all sequences manually to the MAX(id) of the according table. Hopefully now everything works...