How to render a formatted output using HTML?

Reply

Join Date: Sep 2006
Posts: 116
Reputation: bhavna_816 is an unknown quantity at this point 
Solved Threads: 0
bhavna_816 bhavna_816 is offline Offline
Junior Poster

How to render a formatted output using HTML?

 
0
  #1
Feb 1st, 2007
I have developed an application in VB.NET console application.
when i open a particular file suppose txt(Notepad) file then it shows it as it is when i see the
output on console but when i render it to the HTML
then the output is unformatted i.e. it does not understand the format and gives the output like
some special character for example
1> ÿ ÿ (these are the special characters) Regards,
2> for hyperlink it shows the output as HYPERLINK "http://...........com
i want to display the output in a formatted way on the HTML page.
Can anybody have any idea abt this?
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 3,203
Reputation: MidiMagic has a spectacular aura about MidiMagic has a spectacular aura about 
Solved Threads: 164
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Nearly a Senior Poster

Re: How to render a formatted output using HTML?

 
0
  #2
Feb 9th, 2007
Html has several tag pairs tags for this purpose:

code, kbd, pre, samp, tt, var

code is an inline pair of tags used to show computer code

kbd i an inline pairs used to represent keyboard input.

HTML and CSS Syntax (Toggle Plain Text)
  1. <kbd>C:> diskcopy a: b:</kbd>

pre is for preformatted text. It is a block version of code

HTML and CSS Syntax (Toggle Plain Text)
  1. <pre>
  2. for i=1 to 10
  3. print i, a[i]
  4. next i
  5. </pre>

They render everything between them exactly as written, including indenting. It renders as:

HTML and CSS Syntax (Toggle Plain Text)
  1. for i=1 to 10
  2. print i, a[i]
  3. next i

samp is inline for printer output

HTML and CSS Syntax (Toggle Plain Text)
  1. <samp>
  2. Account Total
  3. 0001245 $ 12.45
  4. 0001365 $ 67.21
  5. 0002435 $ 0.00
  6. </samp>

tt is for teletype in a monospace font

var is inline for a variable

All of these are in the xhtml standard as well as the html.
samp shows printer output.
Last edited by MidiMagic; Feb 9th, 2007 at 3:50 pm.
Daylight-saving time uses more gasoline
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 116
Reputation: bhavna_816 is an unknown quantity at this point 
Solved Threads: 0
bhavna_816 bhavna_816 is offline Offline
Junior Poster

Re: How to render a formatted output using HTML?

 
0
  #3
Feb 12th, 2007
Originally Posted by MidiMagic View Post
Html has several tag pairs tags for this purpose:

code, kbd, pre, samp, tt, var

code is an inline pair of tags used to show computer code

kbd i an inline pairs used to represent keyboard input.

HTML and CSS Syntax (Toggle Plain Text)
  1. <kbd>C:> diskcopy a: b:</kbd>

pre is for preformatted text. It is a block version of code

HTML and CSS Syntax (Toggle Plain Text)
  1. <pre>
  2. for i=1 to 10
  3. print i, a[i]
  4. next i
  5. </pre>

They render everything between them exactly as written, including indenting. It renders as:

HTML and CSS Syntax (Toggle Plain Text)
  1. for i=1 to 10
  2. print i, a[i]
  3. next i

samp is inline for printer output

HTML and CSS Syntax (Toggle Plain Text)
  1. <samp>
  2. Account Total
  3. 0001245 $ 12.45
  4. 0001365 $ 67.21
  5. 0002435 $ 0.00
  6. </samp>

tt is for teletype in a monospace font

var is inline for a variable

All of these are in the xhtml standard as well as the html.
samp shows printer output.
<pre></pre> is working with my code it shows the the text same as the original one.
but still this problem is not solved the special character and HYPERLINK
1> ÿ ÿ (these are the special characters) Regards,
2> for hyperlink it shows the output as HYPERLINK "http://...........com
I am searching for more attributes of <pre></pre>
but i m not getting how to remove special characters and all garbage things?
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: How to render a formatted output using HTML?

 
0
  #4
Feb 12th, 2007
For the 'special characters' you might want to try escaping them into HTML entities; or using a different page encoding.

If you don't have too many 'special characters' you can escape them as according to the following table:

http://www.htmlhelp.com/reference/html40/entities/

(There's 3 page of tables [lots of special characters])

If you need to change the encoding (you're using a non-latin character set and, in that case, you have loads of 'special characters') check this out ..

http://www.w3.org/TR/html4/charset.html#h-5.2.1

I'm not sure about the HYPERLINK question.
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 116
Reputation: bhavna_816 is an unknown quantity at this point 
Solved Threads: 0
bhavna_816 bhavna_816 is offline Offline
Junior Poster

Re: How to render a formatted output using HTML?

 
0
  #5
Feb 13th, 2007
Originally Posted by MattEvans View Post
For the 'special characters' you might want to try escaping them into HTML entities; or using a different page encoding.

If you don't have too many 'special characters' you can escape them as according to the following table:

http://www.htmlhelp.com/reference/html40/entities/

(There's 3 page of tables [lots of special characters])

If you need to change the encoding (you're using a non-latin character set and, in that case, you have loads of 'special characters') check this out ..

http://www.w3.org/TR/html4/charset.html#h-5.2.1

I'm not sure about the HYPERLINK question.
For this purpose i heard about MIME so tht i can render the output according to the extension like if there is a zip file then i will allow it to extract to a specified folder, if it is an exe then ask as a dialog box either wan to run or save ,Similarly opening any attachement accordingly. So i heard about MIME concept but i don't know very much about tht.
Are there any other options to do the same?
I have studied the special characters i.e. the Latin encoding i have replace tht "&yuml;" character but it is not get replaced! Now this character is annoying me!
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: How to render a formatted output using HTML?

 
0
  #6
Feb 13th, 2007
I think I misunderstood your original question.

If you're output when viewing a page in the browser is plain text (i.e. not formatted at-all as HTML), then there's a couple of potential reasons:

- the page isn't saved with an extension that maps to the HTML mime type (*.html, *.htm are good choices; *.txt is not). EDIT: if your page is created from a VB.NET application, ignore that reason.

- the page is being sent with an incorrect Content-Type header (a correct Content-Type is text/html, a bad one is text/plain)

Do you have an accessible (online) version of the page?
Last edited by MattEvans; Feb 13th, 2007 at 12:51 am.
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 116
Reputation: bhavna_816 is an unknown quantity at this point 
Solved Threads: 0
bhavna_816 bhavna_816 is offline Offline
Junior Poster

Re: How to render a formatted output using HTML?

 
0
  #7
Feb 13th, 2007
Originally Posted by MattEvans View Post
I think I misunderstood your original question.

If you're output when viewing a page in the browser is plain text (i.e. not formatted at-all as HTML), then there's a couple of potential reasons:

- the page isn't saved with an extension that maps to the HTML mime type (*.html, *.htm are good choices; *.txt is not). EDIT: if your page is created from a VB.NET application, ignore that reason.

- the page is being sent with an incorrect Content-Type header (a correct Content-Type is text/html, a bad one is text/plain)

Do you have an accessible (online) version of the page?
Sorry ! but did't get ur point!
<META http-equiv='Content-Type' content='text/html; charset=ISO-8859-1'>
i m giving this tag !

Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: How to render a formatted output using HTML?

 
0
  #8
Feb 13th, 2007
That isn't neccessarily enough.

The Content-type header is truely specified in the head of a HTTP response, not the head of the HTML page. That META tag might result in some subtle changes to a page as it's rendered as HTML, but infact, a page has to be interpretted as (at-least) XML for that META tag to ever get processed.

If your server is sending a HTTP response header of text/plain, followed by HTML code; your page will not be rendered or processed as HTML.

If you could be clearer in your problem (an online example would be useful), then it would be easier to understand what's actually happening.
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 116
Reputation: bhavna_816 is an unknown quantity at this point 
Solved Threads: 0
bhavna_816 bhavna_816 is offline Offline
Junior Poster

Re: How to render a formatted output using HTML?

 
0
  #9
Feb 13th, 2007
I got the solution for the special characters but still i didn't get the solution for the extension files like zip,exe?????????
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 116
Reputation: bhavna_816 is an unknown quantity at this point 
Solved Threads: 0
bhavna_816 bhavna_816 is offline Offline
Junior Poster

Re: How to render a formatted output using HTML?

 
0
  #10
Feb 13th, 2007
Originally Posted by MattEvans View Post
I think I misunderstood your original question.

If you're output when viewing a page in the browser is plain text (i.e. not formatted at-all as HTML), then there's a couple of potential reasons:

- the page isn't saved with an extension that maps to the HTML mime type (*.html, *.htm are good choices; *.txt is not). EDIT: if your page is created from a VB.NET application, ignore that reason.

- the page is being sent with an incorrect Content-Type header (a correct Content-Type is text/html, a bad one is text/plain)

Do you have an accessible (online) version of the page?
I got the solution for the special characters but still i didn't get the solution for the extension files like zip,exe?????????
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC