set variable and write it out

might be working except unknown charsets.