Added/improved charset mapping

This commit is contained in:
M66B
2020-01-30 21:27:00 +01:00
parent 9b2e4eb2ec
commit 6e7e890043
4 changed files with 26 additions and 65 deletions

View File

@@ -1,48 +0,0 @@
package eu.faircode.email;
/*
This file is part of FairEmail.
FairEmail is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
FairEmail is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FairEmail. If not, see <http://www.gnu.org/licenses/>.
Copyright 2018-2020 by Marcel Bokhorst (M66B)
*/
import android.text.TextUtils;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.charset.spi.CharsetProvider;
import java.util.Collections;
import java.util.Iterator;
public class UnknownCharsetProvider extends CharsetProvider {
@Override
public Iterator<Charset> charsets() {
return Collections.emptyIterator();
}
@Override
public Charset charsetForName(String name) {
// x-binaryenc
// UseInqueCodePage
// none
// unknown-8bit
// X-UNKNOWN
// https://javaee.github.io/javamail/FAQ#unsupen
if (!TextUtils.isEmpty(name))
Log.e("Unknown charset=" + name);
return StandardCharsets.US_ASCII;
}
}