I just said screw it, backed up and exported everything. I deleted the database and recreated it with utf8 charset. I reinstalled wordpress, my theme and imported everything. Not everything worked perfectly but it wasn’t worth the effort of trying to find some obscure bug. Thanks for the help though.