1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-26 15:07:42 +02:00

Let ResponseError render w/ 'text/plain; charset=utf-8' header (#1118) (#1119)

* Let ResponseError render w/ 'text/plain; charset=utf-8' header (#1118)

Trait ResponseError originally render Error messages with header
`text/plain` , which causes browsers (i.e. Firefox 70.0) with
Non-English locale unable to render UTF-8 responses with non-English
characters correctly. i.e. emoji.

This fix solved this problem by specifying the charset of `text/plain`
as utf-8, which is the default charset in rust.

Before actix-web consider to support other charsets, this hotfix is
 enough.

Test case:

fn test() -> Result<String, actix_web::Error> {
    Err(actix_web::error::ErrorForbidden("😋test"))
}

* Update actix-http/CHANGES.md for #1118
This commit is contained in:
SuperHacker-liuan
2019-10-07 12:56:24 +08:00
committed by Nikolay Kim
parent 15d3c1ae81
commit f089cf185b
2 changed files with 6 additions and 2 deletions

View File

@ -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