Fix database encoding