title: Can't get utf-8 upload file name in servlet on server wildfly 9.0.2
body: <p>I want to upload image using servlet with server wildfy 9.0.2. But i can't get unicode utf-8 upload file name. I use code like below:</p>
  
  <p>-upload.jsp</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=UTF-8"
      pageEncoding="UTF-8"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
      "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
  &lt;title&gt;File Upload&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;center&gt;
      &lt;h1&gt;File Upload&lt;/h1&gt;
      &lt;form method="post" action="UploadServlet"
          enctype="multipart/form-data"&gt;
          Select file to upload: &lt;input type="file" name="file" size="60" /&gt;&lt;br /&gt;
          &lt;br /&gt; &lt;input type="submit" value="Upload" /&gt;
      &lt;/form&gt;
  &lt;/center&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>-UploadServlet.java</p>
  
  <pre><code>@WebServlet("/UploadServlet")
  @MultipartConfig(fileSizeThreshold=1024*1024*2, // 2MB 
                   maxFileSize=1024*1024*10,      // 10MB
                   maxRequestSize=1024*1024*50)   // 50MB
  public class UploadServlet extends HttpServlet {
  
      /**
       * Name of the directory where uploaded files will be saved, relative to
       * the web application directory.
       */
      private static final String SAVE_DIR = "uploadFiles";
  
      /**
       * handles file upload
       */
      protected void doPost(HttpServletRequest request,
              HttpServletResponse response) throws ServletException, IOException {
  
          response.setContentType("text/html; charset=UTF-8");
          response.setCharacterEncoding("UTF-8");
          // gets absolute path of the web application
          String appPath = request.getServletContext().getRealPath("");
          // constructs path of the directory to save uploaded file
          String savePath = appPath + File.separator + SAVE_DIR;
  
          // creates the save directory if it does not exists
          File fileSaveDir = new File(savePath);
          if (!fileSaveDir.exists()) {
              fileSaveDir.mkdir();
          }
  
          for (Part part : request.getParts()) {
              String fileName = extractFileName(part);
              System.out.println(fileName);
              part.write(savePath + File.separator + fileName);
          }
  
          request.setAttribute("message", "Upload has been done successfully!");
          getServletContext().getRequestDispatcher("/message.jsp").forward(
                  request, response);
      }
  
      /**
       * Extracts file name from HTTP header content-disposition
       */
      private String extractFileName(Part part) {
          String contentDisp = part.getHeader("content-disposition");
          String[] items = contentDisp.split(";");
          for (String s : items) {
              if (s.trim().startsWith("filename")) {
                  return s.substring(s.indexOf("=") + 2, s.length()-1);
              }
          }
          return "";
      }
  </code></pre>
  
  <p>When i run project and upload image i get file name like below:</p>
  
  <pre><code>éåãå³ä»æ§å¤æ´ã®ãç¥ãã.png
  </code></pre>
  
  <p>Please help me !</p>