code: public String getContentType(String filename, String defaultContentType) {
          String contentType = getMimeType(filename, null);
          if (contentType == null) {
              contentType = defaultContentType;
          }
          if (contentType != null && contentType.startsWith("text/")) {
              // UTF-8 is fixed for now as Pippo only supports utf-8 in files...
              return contentType + "; charset=utf-8";
          }
  
          return contentType;
      }
docs: Returns the content-type from a file name.<br/>
  For a text-based content-type, also return the encoding suffix eg.
  <em>"text/plain; charset=utf-8"</em>
  
  @param filename           the file name
  @param defaultContentType the default content-type to return when no matching
  content-type is found
  @return the content-type deduced from the file extension.