diff --git a/actix-http/CHANGES.md b/actix-http/CHANGES.md index 06756033f..624aca5eb 100644 --- a/actix-http/CHANGES.md +++ b/actix-http/CHANGES.md @@ -6,6 +6,10 @@ * Add support for serde_json::Value to be passed as argument to ResponseBuilder.body() +### Fixed + +* To be compatible with non-English error responses, `ResponseError` rendered with `text/plain; charset=utf-8` header #1118 + ## [0.2.10] - 2019-09-11 diff --git a/actix-http/src/error.rs b/actix-http/src/error.rs index 90c35e486..cd9613d21 100644 --- a/actix-http/src/error.rs +++ b/actix-http/src/error.rs @@ -75,7 +75,7 @@ pub trait ResponseError: fmt::Debug + fmt::Display { let _ = write!(Writer(&mut buf), "{}", self); resp.headers_mut().insert( header::CONTENT_TYPE, - header::HeaderValue::from_static("text/plain"), + header::HeaderValue::from_static("text/plain; charset=utf-8"), ); resp.set_body(Body::from(buf)) } @@ -536,7 +536,7 @@ where let _ = write!(Writer(&mut buf), "{}", self); res.headers_mut().insert( header::CONTENT_TYPE, - header::HeaderValue::from_static("text/plain"), + header::HeaderValue::from_static("text/plain; charset=utf-8"), ); res.set_body(Body::from(buf)) }