Text & Charsets

note

Text & Charsets - 图1

This help topic is in development and will be updated in the future.

This feature allows to process the plain text content in request and response: fills Accept header with registered charsets, encode request body and decode response body according to ContentType charset.

Configuration

If no configuration specified in configuration or HTTP call properties, Charsets.UTF_8 is used by default.

  1. val client = HttpClient(HttpClientEngine) {
  2. Charsets {
  3. // Allow to use `UTF_8`.
  4. register(Charsets.UTF_8)
  5. // Allow to use `ISO_8859_1` with quality 0.1.
  6. register(Charsets.ISO_8859_1, quality=0.1f)
  7. F
  8. // Specify Charset to send request(if no charset in request headers).
  9. sendCharset = ...
  10. // Specify Charset to receive response(if no charset in response headers).
  11. responseCharsetFallback = ...
  12. }
  13. }