Interface EncodingUtils


public interface EncodingUtils
EncodingUtils provides various methods for manipulating and retrieving information related to charsets, locales, and other encoding data.
  • Method Details

    • getDefaultEncoding

      String getDefaultEncoding()
      Query the default encoding.
      Returns:
      String
    • getCharsetFromContentType

      String getCharsetFromContentType(String type)
      Basically returns everything after ";charset=". If no charset specified, return null.
      Parameters:
      type - to extract the charset from.
      Returns:
      The charset encoding.
    • getLocales

      List<Locale> getLocales(String acceptLangHdr)
      Returns a list of locales from the passed in Accept-Language header.
      Parameters:
      acceptLangHdr -
      Returns:
      List
    • getEncodingFromLocale

      String getEncodingFromLocale(Locale locale)
      Get the encoding for a passed in locale.
      Parameters:
      locale -
      Returns:
      The encoding.
    • getJvmConverter

      String getJvmConverter(String encoding)
      Get the JVM Converter for the specified encoding.
      Parameters:
      encoding -
      Returns:
      The converter if it exists, otherwise return the encoding.
    • isCharsetSupported

      boolean isCharsetSupported(String charset)
      Tests whether the specified charset is supported on the server.
      Parameters:
      charset - we want to test
      Returns:
      boolean indicating if supported
    • stripQuotes

      String stripQuotes(String value)
      Utility method to trim off any leading or trailing quotes (single or double).
      Parameters:
      value -
      Returns:
      String (null if null input provided)