encode character vectors too