This week's book giveaway is in the Open Source Projects forum.
We're giving away four copies of Spark in Action and have Jean-Georges Perrin on-line!
See this thread for details.
Win a copy of Spark in Action this week in the Open Source Projects forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Unicode in HTML Output

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an Applet which assembles the results of an SQL query in HTML format, putting the results into a public ByteArrayOutputStream. This output stream is accessed by the calling HTML file in which some JavaScript issues a document.write command to display the results in the browser.
The problem starts when (in Internet Explorer 4) I select File/Save As, saving the output to an HTML file. When I try to open this HTML file in Microsoft Excel 97, Excel complains that the file is not in a recognisable format but opens it up anyway, although it has a funny squiggle at in the first cell.
I think that the problem may be Unicode (Wordpad won't open the output, saying that it has Unicode in it) so have tried to ensure that the Applet outputs only ASCII text using the following code:
public ByteArrayOutputStream outputBytes
= new ByteArrayOutputStream();
for (int i = 0; i < outputString.length(); i++) {
outputBytes.write((int)outputString.charAt(i));
}
This isn't working.
I'm not sure whether the problem is with my understanding of Java, JavaScript, HTML or Excel.
Thanks for any assistance.
 
It means our mission is in jeapordy! Quick, read this tiny ad!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic