code: public static String lookupEncoding(String encoding, String fallback) {
  
          String result = m_encodingCache.get(encoding);
          if (result != null) {
              return result;
          }
  
          try {
              result = Charset.forName(encoding).name();
              m_encodingCache.put(encoding, result);
              return result;
          } catch (Throwable t) {
              // we will use the default value as fallback
          }
  
          return fallback;
      }
docs: Checks if a given encoding name is actually supported, and if so
  resolves it to it's canonical name, if not it returns the given fallback
  value.<p>
  
  Charsets have a set of aliases. For example, valid aliases for "UTF-8"
  are "UTF8", "utf-8" or "utf8". This method resolves any given valid charset name
  to it's "canonical" form, so that simple String comparison can be used
  when checking charset names internally later.<p>
  
  Please see <a href="http://www.iana.org/assignments/character-sets">http://www.iana.org/assignments/character-sets</a>
  for a list of valid charset alias names.<p>
  
  @param encoding the encoding to check and resolve
  @param fallback the fallback encoding scheme
  
  @return the resolved encoding name, or the fallback value