Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Unable to export chinese character in excel use ExcelCSVPrinter file open inline brow

  1. #1
    Junior Member
    Join Date
    Dec 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Unable to export chinese character in excel use ExcelCSVPrinter file open inline brow

    Hi,

    Our application using in English, German, Franch and chinese.
    String chineseCharacter=""; // chineseCharacter like 長长牀床東东彿佛. This chinese data coming from oracle database..

    My code
    ------------
    BufferedWriter printer = new BufferedWriter(new OutputStreamWriter(responses.getOutputStream(),"utf-8"));
    responses.setContentType("application/download");
    responses.setHeader("Cache-Control", "cache");
    responses.setHeader("pragma", "cache");
     
    ExcelCSVPrinter outcr = new ExcelCSVPrinter(printer);
     
    String displayname="ChineseReport.csv";
    responses.setHeader("Content-Disposition","inline; filename=\"" + displayname + "\"");
    outcr.write("Report Header Name");
    outcr.writeln();
    outcr.write(chineseCharacter);
    outcr.writeln();

    After export the data to excel show the result for 長长牀床æ±ä¸œå½¿ä½›. But not show the original result 長长牀床東东彿佛

    I use the following stmt
    responses.setContentType("text/html charset=UTF-8");
    Its shows the correct result for chinese character.

    I use the below statement
    responses.setContentType("application/download; charset=UTF-8");
    or
    responses.setContentType("application/vnd.ms-excelset;charset=UTF-8");
    or
    responses.setContentType("application/vnd.ms-excel;charset=UTF-8");

    The out put show the in the excel sheet ???????? or some other jung characters.
    What can i do here?. After export,I want to show the original chinese character in the excel sheet using the ExcelCSVPrinter.

    Thanks & Regards
    Thendral


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Unable to export chinese character in excel use ExcelCSVPrinter file open inline

    Hello Thendral,

    Did you ever solve this issue?
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

Similar Threads

  1. Facing problem with posting Excel file for download - Content in browser
    By ragz_82 in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: February 9th, 2010, 08:28 AM
  2. Unable to open web service tester page
    By oneofthelions in forum JavaServer Pages: JSP & JSTL
    Replies: 0
    Last Post: December 13th, 2009, 06:20 PM
  3. Unable to create a new connection!
    By fh84 in forum JDBC & Databases
    Replies: 1
    Last Post: November 20th, 2009, 05:58 PM
  4. Vietnamese Character Problem in JSP Report. Chinese and Thai Char OK
    By mrvora in forum JavaServer Pages: JSP & JSTL
    Replies: 7
    Last Post: October 23rd, 2009, 02:35 AM
  5. Export to excel
    By ebosysindia in forum File I/O & Other I/O Streams
    Replies: 7
    Last Post: May 14th, 2009, 06:25 AM