blob: 5164cfd1d11841a92e7df4e00cbc6d328ead086e (
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(5 / 3 * 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
}
|