mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
. Correct fix for UTF-8 filename upload issue: AWC-497
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2452 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -75,6 +75,10 @@ public class UploadFileServlet extends BaseServlet
|
|||||||
|
|
||||||
HttpSession session = request.getSession();
|
HttpSession session = request.getSession();
|
||||||
ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory());
|
ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory());
|
||||||
|
|
||||||
|
// ensure that the encoding is handled correctly
|
||||||
|
upload.setHeaderEncoding("UTF-8");
|
||||||
|
|
||||||
List<FileItem> fileItems = upload.parseRequest(request);
|
List<FileItem> fileItems = upload.parseRequest(request);
|
||||||
|
|
||||||
Iterator<FileItem> iter = fileItems.iterator();
|
Iterator<FileItem> iter = fileItems.iterator();
|
||||||
@@ -94,9 +98,6 @@ public class UploadFileServlet extends BaseServlet
|
|||||||
String filename = item.getName();
|
String filename = item.getName();
|
||||||
if (filename != null && filename.length() != 0)
|
if (filename != null && filename.length() != 0)
|
||||||
{
|
{
|
||||||
// ensure that the encoding is handled correctly
|
|
||||||
filename = new String(filename.getBytes(), "UTF8").toString();
|
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
logger.debug("Processing uploaded file: " + filename);
|
logger.debug("Processing uploaded file: " + filename);
|
||||||
|
|
||||||
|
@@ -49,7 +49,7 @@ public class UploadFormTag extends TagSupport
|
|||||||
{
|
{
|
||||||
Writer out = pageContext.getOut();
|
Writer out = pageContext.getOut();
|
||||||
|
|
||||||
out.write("<form name='upload-form' method='post' enctype='multipart/form-data' action='");
|
out.write("<form name='upload-form' acceptCharset='UTF-8' method='post' enctype='multipart/form-data' action='");
|
||||||
|
|
||||||
if (Application.inPortalServer())
|
if (Application.inPortalServer())
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user