use charset encoding for send_string

This commit is contained in:
Martin Algesten
2018-06-22 11:34:39 +02:00
parent 48dcdeb92a
commit e9ccf1c2cc
4 changed files with 57 additions and 17 deletions

View File

@@ -67,7 +67,18 @@
//! .set("Transfer-Encoding", "chunked")
//! .send_string("Hello world");
//! ```
//!
//! # Character encoding
//!
//! For [`response.into_string()`](struct.Response.html#method.into_string) we read the
//! header `Content-Type: text/plain; charset=iso-8859-1` and if it contains a charset
//! specification, we try to decode the body using that encoding. In the absence of, or failing
//! to interpret the charset, we fall back on `utf-8`.
//!
//! Similarly when using [`.send_string()`](struct.Request.html#method.send_string), to
//! we first check if the user has set a `; charset=<whatwg charset>` and attempt
//! to encode the request body using that.
//!
extern crate ascii;
extern crate base64;
extern crate chunked_transfer;