• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to display Japanese characters in excel sheet?

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am currently working in a Japanese project.I am facing some problems in displaying japanese characters in excel sheet in windows NT env (english Version).
I am using servlet and jsp to display the japanese characters in the excel sheet.In the servlet i am setting all the neceseary things for response such as
contentType("application:excel,charset=utf-8") etc...
But i am not getting the japanese characters correctly.Instead i am getting junk characters in the japanese fields.

Kindly suggest me some solutions to solve the above mentioned problem..
regards
Dinesh
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dinesh,
Please do not post the same topic in multiple forums. I am moving this to the Servlets forum.
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As an experiment, try writing the data as HTML content instead, and see if you can view the characters that way. The basic possibilities are: (a) you haven't read in the data correctly in the first place, (b) something is wrong with how you're sending it, and (c) the Excel application isn't set up to view Japanese chars correctly. By displaying the data in other formats, you can get an idea where the problem is.
 
Dinesh Ramaswamy
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jim,
As u told i tried with different type like html and text file.Then also i am getting the same junk format.Actually in the servlet i am diong all this things:
httpservletresponse.setContentType("application/vnd.ms-excel;charset=UTF-16");
//httpservletresponse.setContentType("text/html;charset=UTF-8");
httpservletresponse.setHeader("Content-Disposition", "attachment; filename="+fileName+".html");
httpservletresponse.setHeader("Content-Encoding", "UTF-8");
is it because of that UTF-8,i tried to set the encoding as UTF-16.But it giving some run time error stating that
Internal error: exception thrown from the servlet service function (uri=/gehfs/reports/ReportServlet): java.io.UnsupportedEncodingException: UTF-16, stack: java.io.UnsupportedEncodingException: UTF-16
at sun.io.Converters.getConverterClass(Converters.java:97)
at sun.io.Converters.newConverter(Converters.java:128)
at sun.io.CharToByteConverter.getConverter(CharToByteConverter.java:71)
at java.io.OutputStreamWriter.<init>(OutputStreamWriter.java:78)
at com.netscape.server.http.servlet.NSServletResponse.getWriter(NSServletResponse.java:72)
at gehfs.reports.action.HFSReportAction.generateReportForDownload(HFSReportAction.java, Compiled Code)
at gehfs.reports.action.HFSReportAction.executeBusinessMethod(HFSReportAction.java:57)
at gehfs.reports.controller.HFSReportServlet.doPost(HFSReportServlet.java, Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:826)
at com.netscape.server.http.servlet.NSServletRunner.Service(NSServletRunner.java:533)
, root cause:

Please help me out in sorting thse problem.
Regards
Sriram
 
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Set content type to "Shift_JIS", that should do the job
 
Can't .... do .... plaid .... So I did this tiny ad instead:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic