text encoding improvements