Fixing encoding issue when persisting to sqlite.