Class CharsetUtil


  • public class CharsetUtil
    extends Object
    Helper class for working with charsets and enabling the UTF-8 with fallback charsets: X-UTF-8_with_ISO-8859-1_fallback X-UTF-8_with_windows-1252_fallback
    Since:
    3.15
    Author:
    nicklas
    • Field Detail

      • UTF8_WITH_FALLBACK

        public static final CharsetProvider UTF8_WITH_FALLBACK
        The provider that is providing the UTF-8 with fallback characeter sets.
    • Constructor Detail

      • CharsetUtil

        public CharsetUtil()
    • Method Detail

      • getCharset

        public static Charset getCharset​(String name)
        Get a character set by name. This will first look if it is a UTF-8 with fallback charset and if not check the system Charset.forName(String).
      • getAllCharsets

        public static List<String> getAllCharsets​(boolean includeFallbacks)
        Get all charsets that Config.getAllCharsets() returns and optionally include the fallback charsets. Note that the fallback charsets are automatically sorted just below the UTF-8 character set.