Class XMLCharsetDeterminator


  • @Immutable
    public final class XMLCharsetDeterminator
    extends Object
    XML charset determinator based on a byte array.
    Since:
    9.0.0
    Author:
    Philip Helger
    • Field Detail

      • FALLBACK_CHARSET

        public static final Charset FALLBACK_CHARSET
    • Method Detail

      • getAllSupportedCharsets

        @Nonnull
        @ReturnsMutableCopy
        public static com.helger.commons.collection.impl.ICommonsSet<Charset> getAllSupportedCharsets()
        Returns:
        A mutable Set with all charsets that can be used for the charset determination. Never null.
      • determineXMLCharset

        @Nullable
        public static Charset determineXMLCharset​(@Nonnull
                                                  byte[] aBytes)
        Determine the XML charset
        Parameters:
        aBytes - XML byte representation
        Returns:
        null if no charset was found. In that case you might wanna try UTF-8 as the fallback.