Convert string when encoding is not nil (#467)