HttpResponse::Ok() header that can not be transformed to string
⚓ Rust 📅 2025-09-24 👤 surdeus 👁️ 7Hi,
I work with actix-web. I make a response that send a pdf and I put a report in header. So report is a custom header.
I write some string with some accent in the report that has a json value.
HttpResponse::Ok()
                    .append_header(("Access-Control-Expose-Headers", "REPORT"))
                    .append_header(("REPORT", json))
                    .content_type("application/pdf")
                    .body(pdf)),
But when I get the answer I have some character that can not be transformed in string.
 g\xc3\xa9n\xc3\xa9r\xc3\xa9
Do you know a way to have a good string formed ? Because when it is in the body, there is no problem, just in header...
3 posts - 2 participants
🏷️ Rust_feed