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.
If you cannot guarantee that all bytes of the header are valid ASCII, you should not pass those into the header in the first place. A proper encoding scheme that guarantees ASCII, like the suggested base64, should prove more stable when it comes to protocol compliance.