Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem reading a html file  RSS feed

 
Manjit Barman
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am writting an Mail Servlet Application using Java Mail API.
In in the application, i am sending an html/.htm file as an attachment. When i open the attachment from the mail, characters like ' and " appears as question mark(?). My question is, how to read the single quotes and double quotes?

Here is the code snippet:

BufferedReader din;
String s;
din = new BufferedReader(new InputStreamReader(new BufferedInputStream(new FileInputStream(file))));
//while((s = din.readLine())!= null)
StringBuffer sBuff=new StringBuffer();
while ((s = din.readLine()) != null) {
sBuff.append(s + "\n");
}
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You probably need to set the character encoding on the attachment.

Moving to Other Java APIs...
 
Manjit Barman
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ilja Preuss,

Yes, that was the reason. I could figure out that!
Anyway, thanks a heap for your response.
You are great though!

Manjit
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!