19 lines
476 B
Rust
19 lines
476 B
Rust
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
|
|
}
|