Details
-
Type: Improvement
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 1.7.2 SP1
-
Component/s: ICE-Components
-
Labels:None
-
Environment:Linux, Windows, Mac OS X & IE, Safari, Firefox & Glassfish v2
-
ICEsoft Forum Reference:
Description
I have problems with downloading files via OutputResource where filename contains special characters like €, £, ... Also it doesn't work for our national characters like ěščřžýáíéĚŠČŘŽÝÁÉ. Anyway, I was able to manage file upload with these special characters via CharsetFilter (mentioned in the forum post). But I'm not able to download these files with correct file name. I tried lot of things, spent few weeks in forums, but I can't find a way how to download file with special characters in the filename via OutputResource.
I think it's a bug of OutputResource, because instead of writing filename directly to Content-Disposition, it should encode it somehow first.
I think it's a bug of OutputResource, because instead of writing filename directly to Content-Disposition, it should encode it somehow first.
Activity
Robert Vojta
created issue -
Ken Fyten
made changes -
Field | Original Value | New Value |
---|---|---|
Assignee | Ken Fyten [ ken.fyten ] |
Sandro Lehmann
made changes -
Attachment | fileName with '('.jpg [ 11838 ] |
Ken Fyten
made changes -
Salesforce Case | [] | |
Fix Version/s | 1.8.2 [ 10190 ] | |
Assignee Priority | P3 | |
Assignee | Ken Fyten [ ken.fyten ] | Yip Ng [ yip.ng ] |
yip.ng
made changes -
Attachment | ScreenHunter_01.jpg [ 11852 ] |
yip.ng
made changes -
Attachment | ScreenHunter_01.jpg [ 11852 ] |
Repository | Revision | Date | User | Message |
ICEsoft Public SVN Repository | #19090 | Mon Jul 20 14:12:19 MDT 2009 | yip.ng | Fixe bugs that caused download failure of files with special characters in their file names. |
Files Changed | ||||
MODIFY
/icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/outputresource/OutputResource.java
MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/webapp/http/core/ResourceDispatcher.java |
yip.ng
made changes -
Attachment | ScreenHunter_01.jpg [ 11856 ] | |
Attachment | ScreenHunter_02.jpg [ 11857 ] | |
Attachment | ScreenHunter_03.jpg [ 11858 ] |
yip.ng
made changes -
Attachment | ScreenHunter_04.jpg [ 11859 ] |
yip.ng
made changes -
Status | Open [ 1 ] | Resolved [ 5 ] |
Resolution | Fixed [ 1 ] |
yip.ng
made changes -
Resolution | Fixed [ 1 ] | |
Status | Resolved [ 5 ] | Reopened [ 4 ] |
yip.ng
made changes -
Attachment | ScreenHunter_05.jpg [ 11862 ] |
yip.ng
made changes -
Attachment | ScreenHunter_06.jpg [ 11865 ] | |
Attachment | ScreenHunter_07.jpg [ 11866 ] |
yip.ng
made changes -
Attachment | c-s-jsp.war [ 11867 ] |
Repository | Revision | Date | User | Message |
ICEsoft Public SVN Repository | #19107 | Wed Jul 22 16:41:34 MDT 2009 | yip.ng | Fixe bugs that caused download failure of files with special characters in their file names. |
Files Changed | ||||
MODIFY
/icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/outputresource/OutputResource.java
MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/webapp/http/core/ResourceDispatcher.java |
yip.ng
made changes -
Attachment | ScreenHunter_08.jpg [ 11872 ] | |
Attachment | ScreenHunter_09.jpg [ 11873 ] | |
Attachment | ScreenHunter_10.jpg [ 11874 ] |
yip.ng
made changes -
Attachment | c-s-jsp.war [ 11867 ] |
yip.ng
made changes -
Attachment | c-s-jsp.war [ 11875 ] |
Repository | Revision | Date | User | Message |
ICEsoft Public SVN Repository | #19114 | Thu Jul 23 16:03:39 MDT 2009 | yip.ng | Fixe bugs that caused download failure of files with special characters in their file names. |
Files Changed | ||||
MODIFY
/icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/outputresource/OutputResource.java
MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/webapp/http/core/ResourceDispatcher.java |
yip.ng
made changes -
Attachment | c-s-jsp.war [ 11875 ] |
yip.ng
made changes -
Attachment | c-s-jsp.war [ 11879 ] |
yip.ng
made changes -
Status | Reopened [ 4 ] | Resolved [ 5 ] |
Resolution | Fixed [ 1 ] |
Repository | Revision | Date | User | Message |
ICEsoft Public SVN Repository | #19137 | Fri Jul 31 11:36:14 MDT 2009 | yip.ng | Fixe bugs that caused download failure of files with special characters in their file names. |
Files Changed | ||||
MODIFY
/icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/outputresource/OutputResource.java
|
Ken Fyten
made changes -
Issue Type | Bug [ 1 ] | Improvement [ 4 ] |
Salesforce Case | [] |
Ken Fyten
made changes -
Fix Version/s | 1.8.2-RC1 [ 10210 ] |
Ken Fyten
made changes -
Status | Resolved [ 5 ] | Closed [ 6 ] |
Assignee Priority | P3 |
You can look at http://greenbytes.de/tech/tc2231/ for more info how this can be done. The problem is that there's no standard way how to do this for all browsers and you have to handle separate versions of IE as well I've workaround with the following code in Java and I pass function return value to OutputResource filename parameter. This works for IE / Firefox ...
private static String encodeForIE(String fileName)
{ /* * http://greenbytes.de/tech/tc2231/#attwithfnrawpctenca * * IE decodes %XY to characters and than if it detects * UTF-8 stream (after decoding of %XY), than it creates * UTF-8 string. * * We use this behavior to offer correct file name * for download. */ StringBuilder encodedFileName = new StringBuilder(); encodedFileName.append("\""); // ICEfaces 1.7.2 bug encodedFileName.append(URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20")); encodedFileName.append("\""); // ICEfaces 1.7.2 bug return encodedFileName.toString(); }throws UnsupportedEncodingException
private static String encodeForFirefox(String fileName)
throws UnsupportedEncodingException {
/*
*
*
*/
StringBuilder encodedFileName = new StringBuilder();
encodedFileName.append("\""); // ICEfaces 1.7.2 bug
byte[] utf8Bytes = fileName.getBytes("UTF-8");
{ char ch = (char) b; encodedFileName.append(ch); }for (byte b : utf8Bytes)
encodedFileName.append("\""); // ICEfaces 1.7.2 bug
return encodedFileName.toString();
}