中文乱码及utf-8

933302
2021/12/09 05:53:46

此前版本需要手动设置该响应头,比如:

async fn cn() -> (HeaderMap, &'static str) {
    let mut headers = HeaderMap::new();
    headers.insert(
        HeaderName::from_static("content-type"),
        HeaderValue::from_static("text/plain;charset=utf-8"),
    );
    (headers, "你好,axum.rs")
}