Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

File dialog box is unable to show japanese characters. These characters are getting displayed on other browsers. Is there any special settings for this?

  • No replies
  • 3 have this problem
  • 3 views
more options

I have to download file from browser. When browser is displaying save dialog box then in that dialog box it is not displaying Japanese characters properly. These Japanese characters are getting displayed properly on other browsers. Here I am giving my java code which is opening that dialog box,

public static void export( HttpServletResponse resp, String data,

                            String encoding, String filename )
   throws ServletException
   {
   try
     {
     byte[] bytes = data.getBytes( encoding );
     Assert.assertNotNull( bytes );
     filename = filename.replace( '/', '-' );
     filename = filename.replace( ':', '-' );
     resp.setContentType( "text/html; charset=UTF-8" );
     
     filename = java.net.URLEncoder.encode(filename,"UTF-8");
     resp.setHeader( "Content-Disposition",
                     "attachment;filename=\""+ new String(filename.getBytes()) + "\"");
     resp.setBufferSize( bytes.length );
     resp.setContentLength( bytes.length );
     resp.getOutputStream().write( bytes );
     }
   catch( Exception ex )
     {
     throw new ServletException( ex );
     }
   }
I have to download file from browser. When browser is displaying save dialog box then in that dialog box it is not displaying Japanese characters properly. These Japanese characters are getting displayed properly on other browsers. Here I am giving my java code which is opening that dialog box, public static void export( HttpServletResponse resp, String data, String encoding, String filename ) throws ServletException { try { byte[] bytes = data.getBytes( encoding ); Assert.assertNotNull( bytes ); filename = filename.replace( '/', '-' ); filename = filename.replace( ':', '-' ); resp.setContentType( "text/html; charset=UTF-8" ); filename = java.net.URLEncoder.encode(filename,"UTF-8"); resp.setHeader( "Content-Disposition", "attachment;filename=\""+ new String(filename.getBytes()) + "\""); resp.setBufferSize( bytes.length ); resp.setContentLength( bytes.length ); resp.getOutputStream().write( bytes ); } catch( Exception ex ) { throw new ServletException( ex ); } }