Search in sources :

Example 6 with JabRefPreferences

use of org.jabref.preferences.JabRefPreferences in project jabref by JabRef.

the class PreferencesMigrations method upgradeFaultyEncodingStrings.

/**
     * Added from Jabref 2.11 beta 4 onwards to fix wrong encoding names
     */
public static void upgradeFaultyEncodingStrings() {
    JabRefPreferences prefs = Globals.prefs;
    String defaultEncoding = prefs.get(JabRefPreferences.DEFAULT_ENCODING);
    if (defaultEncoding == null) {
        return;
    }
    Map<String, String> encodingMap = new HashMap<>();
    encodingMap.put("UTF8", "UTF-8");
    encodingMap.put("Cp1250", "CP1250");
    encodingMap.put("Cp1251", "CP1251");
    encodingMap.put("Cp1252", "CP1252");
    encodingMap.put("Cp1253", "CP1253");
    encodingMap.put("Cp1254", "CP1254");
    encodingMap.put("Cp1257", "CP1257");
    encodingMap.put("ISO8859_1", "ISO8859-1");
    encodingMap.put("ISO8859_2", "ISO8859-2");
    encodingMap.put("ISO8859_3", "ISO8859-3");
    encodingMap.put("ISO8859_4", "ISO8859-4");
    encodingMap.put("ISO8859_5", "ISO8859-5");
    encodingMap.put("ISO8859_6", "ISO8859-6");
    encodingMap.put("ISO8859_7", "ISO8859-7");
    encodingMap.put("ISO8859_8", "ISO8859-8");
    encodingMap.put("ISO8859_9", "ISO8859-9");
    encodingMap.put("ISO8859_13", "ISO8859-13");
    encodingMap.put("ISO8859_15", "ISO8859-15");
    encodingMap.put("KOI8_R", "KOI8-R");
    encodingMap.put("Big5_HKSCS", "Big5-HKSCS");
    encodingMap.put("EUC_JP", "EUC-JP");
    if (encodingMap.containsKey(defaultEncoding)) {
        prefs.put(JabRefPreferences.DEFAULT_ENCODING, encodingMap.get(defaultEncoding));
    }
}
Also used : HashMap(java.util.HashMap) JabRefPreferences(org.jabref.preferences.JabRefPreferences)

Aggregations

JabRefPreferences (org.jabref.preferences.JabRefPreferences)6 BackingStoreException (java.util.prefs.BackingStoreException)3 Preferences (java.util.prefs.Preferences)3 HashMap (java.util.HashMap)1 ArgumentProcessor (org.jabref.cli.ArgumentProcessor)1 JabRefMessageHandler (org.jabref.gui.remote.JabRefMessageHandler)1 ExportFormat (org.jabref.logic.exporter.ExportFormat)1 SavePreferences (org.jabref.logic.exporter.SavePreferences)1 JournalAbbreviationLoader (org.jabref.logic.journals.JournalAbbreviationLoader)1 LayoutFormatterPreferences (org.jabref.logic.layout.LayoutFormatterPreferences)1 ProxyAuthenticator (org.jabref.logic.net.ProxyAuthenticator)1 ProxyPreferences (org.jabref.logic.net.ProxyPreferences)1 ProtectedTermsLoader (org.jabref.logic.protectedterms.ProtectedTermsLoader)1 RemotePreferences (org.jabref.logic.remote.RemotePreferences)1