• 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

Problem with special characters (POI, jXLS)

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello. Our application utilizes POI and jXLS to create a HSSFWorkbook. When a user copies text from a Microsoft Word document containing special characters (e.g. double quotes, single quotes, etc.) into our application, the characters are not displayed correctly in the resulting Excel file. I have already tried setContentType and setCharacterEncoding on the HttpServletResponse object. Does anyone have any additional ideas on correctly displaying these special Windows characters?

Thanks in advance for your help!
 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Somebody copies text from Word, including the misnamed "smart" quotes, and pastes it into an HTML text box. This text is then sent to a servlet in your web application, and this servlet uses POI or jXLS to put it into an Excel spreadsheet. Is that an accurate description of the process?

To deal with the browser-to-servlet step, you should read this article: Character Conversions from Browser to Database. The saving-to-Excel part is a separate problem and I don't know the answer to that. But to get it working you should not use a complicated thing like a servlet as your testing tool. Write a small Java application that just tries to make a simple Excel spreadsheet containing those characters. Which by the way are "\u201c" and "\u201d"; put those directly into your small application, don't try to get them from outside.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic