1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-30 19:56:10 +00:00

Normalize charset names

This commit is contained in:
M66B 2022-01-31 18:35:04 +01:00
parent e196b9f0ae
commit 1ea8c5a086

View file

@ -20,6 +20,7 @@ import android.text.TextUtils;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.charset.spi.CharsetProvider;
import java.text.Normalizer;
import java.util.Collections;
import java.util.Iterator;
@ -56,6 +57,10 @@ public class UnknownCharsetProvider extends CharsetProvider {
name = name.replace("\"", "");
// WİNDOWS-1254
name = Normalizer.normalize(name, Normalizer.Form.NFKD)
.replaceAll("[^\\p{ASCII}]", "");
int sp = name.indexOf(" ");
if (sp > 0)
name = name.substring(0, sp);