943,685 Members | Top Members by Rank

Ad:
You are currently viewing page 1 of this multi-page discussion thread
Feb 1st, 2007
0

How to render a formatted output using HTML?

Expand Post »
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?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster
bhavna_816 is offline Offline
116 posts
since Sep 2006
Feb 9th, 2007
0

Re: How to render a formatted output using HTML?

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.
Reputation Points: 730
Solved Threads: 181
Nearly a Senior Poster
MidiMagic is offline Offline
3,314 posts
since Jan 2007
Feb 12th, 2007
0

Re: How to render a formatted output using HTML?

Click to Expand / Collapse  Quote originally posted by MidiMagic ...
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?
Reputation Points: 10
Solved Threads: 0
Junior Poster
bhavna_816 is offline Offline
116 posts
since Sep 2006
Feb 12th, 2007
0

Re: How to render a formatted output using HTML?

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.
Moderator
Featured Poster
Reputation Points: 522
Solved Threads: 64
Veteran Poster
MattEvans is offline Offline
1,091 posts
since Jul 2006
Feb 13th, 2007
0

Re: How to render a formatted output using HTML?

Click to Expand / Collapse  Quote originally posted by MattEvans ...
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!
Reputation Points: 10
Solved Threads: 0
Junior Poster
bhavna_816 is offline Offline
116 posts
since Sep 2006
Feb 13th, 2007
0

Re: How to render a formatted output using HTML?

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.
Moderator
Featured Poster
Reputation Points: 522
Solved Threads: 64
Veteran Poster
MattEvans is offline Offline
1,091 posts
since Jul 2006
Feb 13th, 2007
0

Re: How to render a formatted output using HTML?

Click to Expand / Collapse  Quote originally posted by MattEvans ...
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 !

Reputation Points: 10
Solved Threads: 0
Junior Poster
bhavna_816 is offline Offline
116 posts
since Sep 2006
Feb 13th, 2007
0

Re: How to render a formatted output using HTML?

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.
Moderator
Featured Poster
Reputation Points: 522
Solved Threads: 64
Veteran Poster
MattEvans is offline Offline
1,091 posts
since Jul 2006
Feb 13th, 2007
0

Re: How to render a formatted output using HTML?

I got the solution for the special characters but still i didn't get the solution for the extension files like zip,exe?????????
Reputation Points: 10
Solved Threads: 0
Junior Poster
bhavna_816 is offline Offline
116 posts
since Sep 2006
Feb 13th, 2007
0

Re: How to render a formatted output using HTML?

Click to Expand / Collapse  Quote originally posted by MattEvans ...
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?????????
Reputation Points: 10
Solved Threads: 0
Junior Poster
bhavna_816 is offline Offline
116 posts
since Sep 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: HTML table vertical aligning problem
Next Thread in HTML and CSS Forum Timeline: I need help with this, please anyone?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC