title: How can I find the encoding of a FileItemStream returned by FileItemIterator?
body: <p>I use Apache Commons FileUpload to receive uploaded files in a Servlet, as described at <a href="http://code.google.com/appengine/kb/java.html#fileforms" rel="nofollow noreferrer">http://code.google.com/appengine/kb/java.html#fileforms</a></p>
  
  <pre><code>        ServletFileUpload upload = new ServletFileUpload();
  
          FileItemIterator iterator = upload.getItemIterator(request);
  
          while (iterator.hasNext()) {
              FileItemStream item = iterator.next();
              InputStream stream = item.openStream();
  
              if (!item.isFormField()) {
                System.out.println("Got an uploaded file: " + item.getFieldName()
                          + ", name = " + item.getName() + " type = " +               item.getContentType());
  
              }
  </code></pre>
  
  <p>I am not sure if item.getContentType() also will coutain the file encoding for text files which could be different from the request encoding, (for example ISO-8859-1), or if it always only contains the file type only. In my tests I received only "text/plain" but I was expecting "text/plain; Encoding=ISO-8859-1" which has been sent from the client.</p>
  
  <p>Is my understanding correct that the item.getContentType() should include the encoding (if it is sent from client)?</p>