Remove duplication in as_utf16_p