Skip to content

Commit 651ced5

Browse files
committed
fix: add utf-7 equivalent charset labels
1 parent 0bfded4 commit 651ced5

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/decoders/charsets/map.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ fn primary_charset_decoder(charset: &[u8]) -> Option<fn(&[u8]) -> String> {
161161
"utf_16be" => decoder_utf16_be,
162162
"utf_16le" => decoder_utf16_le,
163163
"utf_7" => decoder_utf7,
164+
"x_unicode_2_0_utf_7" => decoder_utf7,
165+
"unicode_1_1_utf_7" => decoder_utf7,
166+
"csunicode11utf7" => decoder_utf7,
164167
"windows_1250" => decoder_cp1250,
165168
"windows_1251" => decoder_cp1251,
166169
"windows_1252" => decoder_cp1252,

src/decoders/encoded_word.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,23 @@ mod tests {
149149
"مرحبا بالعالم",
150150
true,
151151
),
152+
// utf-7 and equivalent charset labels from the charset crate
153+
("?utf-7?Q?Heinz_M+APw-ller?=", "Heinz Müller", true),
154+
(
155+
"?x-unicode-2-0-utf-7?Q?Heinz_M+APw-ller?=",
156+
"Heinz Müller",
157+
true,
158+
),
159+
(
160+
"?unicode-1-1-utf-7?Q?Heinz_M+APw-ller?=",
161+
"Heinz Müller",
162+
true,
163+
),
164+
(
165+
"?csunicode11utf7?Q?Heinz_M+APw-ller?=",
166+
"Heinz Müller",
167+
true,
168+
),
152169
#[cfg(feature = "full_encoding")]
153170
(
154171
"?shift_jis?B?g26DjYFbgUWDj4Fbg4uDaA==?=",

0 commit comments

Comments
 (0)