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:
parent
e196b9f0ae
commit
1ea8c5a086
1 changed files with 5 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue