Hi,
to get the correct encoded filename i do this:
String encoding = request.getCharacterEncoding();
if (encoding == null) {
encoding = "UTF-8";
}
String fileName = new String(attachment.getName().getBytes(), encoding);
Regards,
Volker
2007/8/25, Владимир Петров <[EMAIL PROTECTED]>:
> 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.
>