Skip to content
Permalink
Browse files
Adjust mime encoding
Reviewed-by: ehelin
  • Loading branch information
rwestberg committed Nov 4, 2019
1 parent 4ac34b9 commit 7984f332540eaa8f6bc49883a511cfb6ccf4441b
Showing 2 changed files with 2 additions and 2 deletions.
@@ -34,7 +34,7 @@ public class MimeText {

public static String encode(String raw) {
var quoteMatcher = encodePattern.matcher(raw);
return quoteMatcher.replaceAll(mo -> "=?utf-8?b?" + Base64.getEncoder().encodeToString(String.valueOf(mo.group(1)).getBytes(StandardCharsets.UTF_8)) + "?=");
return quoteMatcher.replaceAll(mo -> "=?UTF-8?B?" + Base64.getEncoder().encodeToString(String.valueOf(mo.group(1)).getBytes(StandardCharsets.UTF_8)) + "?=");
}

public static String decode(String encoded) {
@@ -29,7 +29,7 @@
class MimeTextTests {
@Test
void encode() {
assertEquals("=?utf-8?b?w6XDpMO2?=", MimeText.encode("åäö"));
assertEquals("=?UTF-8?B?w6XDpMO2?=", MimeText.encode("åäö"));
}

@Test

0 comments on commit 7984f33

Please sign in to comment.