blob: fa6b8517f0af06262a1614cf854ee0a3c1fe6a34 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
use super::*;
pub fn encode_header(value: &str) -> String {
eprintln!("encoding \"{}\"", value);
let mut ret = String::with_capacity(value.len());
for word in value.split_whitespace() {
if word.is_ascii() {
ret.push_str(word);
} else {
ret.push_str(
format!("=?UTF-8?B?{}?=", BASE64_MIME.encode(word.trim().as_bytes())).trim(),
);
}
ret.push(' ');
}
ret.pop();
ret
}
|