function ustring(val) {
  var str = String(val)

  // percent encode as UTF-8
  var encoded = encodeURIComponent(str)
    .replace(encodeUriAttrCharRegExp, pencode)

  return 'UTF-8\'\'' + encoded
}
Encode a Unicode string for HTTP (RFC 5987).

@param {string} val
@return {string}
@api private