Здравствуйте Владимир!
did you try response.setContentType("application/bin; charset=utf-8"); ?
The main problem is that http header field value only accept brute
ISO-8859-1, which does not contains cyrilic i think.
According to http specification, it "MAY contain characters from
character sets other than ISO- 8859-1 [22]
<http://www.w3.org/Protocols/rfc2616/rfc2616-sec17.html#bib22> only when
encoded according to the rules of RFC 2047".
I suppose tomcat should do it itself, but i never tried. If not, you may
need to do i your self by applying rfc 2047 rules to your filename and
hope your browser supports it :D
http://www.ietf.org/rfc/rfc2047.txt
Владимир Петров a écrit :
Hello! I'm from Russia. And I not so well speak in English. i am trying to get
the data from database to jsp. If the name of the file on English - in the
dialogue normal characters, all works. If the name of the file on Russian - in
the dialogue hieroglyphs and nothing works. Please respond.
jsp:
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page pageEncoding="UTF-8"%>
<%@ page import="java.io.File,
java.io.InputStream,
java.io.FileInputStream,
java.io.OutputStream"%>
<%@ page session="false" %>
<%
String fileName = (String)application.getAttribute("fileupload_name");
String contentType = (String)application.getAttribute("fileupload_type");
if(contentType!=null){
response.setContentType(contentType);
}
StringBuffer contentDisposition = new StringBuffer();
contentDisposition.append("attachment;");
//URLEncoder.encode(fileName, "UTF-8");
contentDisposition.append("filename=\"");
contentDisposition.append(fileName);
contentDisposition.append("\"");
response.setHeader ("Content-Disposition", contentDisposition.toString());
byte[] bytes = (byte[])application.getAttribute("fileupload_bytes");
if (bytes != null){
response.getOutputStream().write(bytes);
}
%>
Thank by all.