From 50c8114d791602fcc427c6dc94b55f3226e8a21d Mon Sep 17 00:00:00 2001 From: Ken Hornstein Date: Mon, 2 Dec 2013 23:14:47 -0500 Subject: [PATCH] Use pref_encoding() to select the default encoding for all headers. --- sbr/encode_rfc2047.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sbr/encode_rfc2047.c b/sbr/encode_rfc2047.c index 54a1e088..ac340f71 100644 --- a/sbr/encode_rfc2047.c +++ b/sbr/encode_rfc2047.c @@ -125,14 +125,14 @@ encode_rfc2047(const char *name, char **value, int encoding, * On the encoding we choose, and the specifics of encoding: * * - If a specified encoding is passed in, we use that. - * - If more than 50% of the characters are high-bit, we use base64 - * and encode the whole field as one atom (possibly split). - * - Otherwise, we use quoted-printable. + * - Otherwise, pick which encoding is shorter. + * + * We don't quite handle continuation right here, but it should be + * pretty close. */ if (encoding == CE_UNKNOWN) - encoding = (eightbitcount * 10 / (asciicount + eightbitcount) > 5) ? - CE_BASE64 : CE_QUOTED; + encoding = pref_encoding(asciicount, qpspecialcount, eightbitcount); unfold_header(value, asciicount + eightbitcount); -- 2.56.0