Improve the efficiency of header and query string encoding.