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?

Recommended Answers

All 10 Replies

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.

<kbd>C:> diskcopy a: b:</kbd>

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

<pre>
 for i=1 to 10
   print i, a[i]
 next i
 </pre>

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

for i=1 to 10
   print i, a[i]
 next i

samp is inline for printer output

<samp>
Account    Total
0001245   $  12.45
0001365   $  67.21
0002435   $   0.00
</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.

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.

<kbd>C:> diskcopy a: b:</kbd>

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

<pre>
 for i=1 to 10
   print i, a[i]
 next i
 </pre>

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

for i=1 to 10
   print i, a[i]
 next i

samp is inline for printer output

<samp>
Account    Total
0001245   $  12.45
0001365   $  67.21
0002435   $   0.00
</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?

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 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!

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 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 !

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.

I got the solution for the special characters but still i didn't get the solution for the extension files like zip,exe?????????

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?????????

If you just 'return' a stored zip file or other file to a browser, you don't have to do anything. For example, if a user visits:

http://www.example.com/example.zip

The zip file will ordinarily be handled by the browser's MIME configuration, and the user will be allowed to download it.

However. If your server's MIME handler configuration is messed up, then the server might try to process the file internally, or send the file as if it were page content. You'd have to talk to your hosting provider or look in your server software manual and tell the server NOT try to try to handle zip files, but send them with a valid MIME type.

If you're 'creating' zip data and sending it back from a request, you would need to specify a Content-Type header that described the content =P

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.