Include UTF8 garbage in asp.net

Source: Internet
Author: User
For the moment, we will not discuss why SSI should be used, rather than other technologies (such as UserControl)

To generate index.shtml, BOM must be included. In fact, blank lines will appear on the page even if it is not included.

The content of index.shtml is as follows:

<Html>
<Body>

<! -- # Include file = "head.shtml" -->

</Body>

</Html>
 
When 110000head.shtml is saved as a UTF-8 with BOM, a blank line appears (the page elements are more than that of course ).

22.16head.shtml is stored as a UTF-8 without BOM, garbled because SSInc. when the dll loads this file, it does not know the file encoding (because there is no BOM signature), so it will load the file by GBK, and finally garbled...

So neither can we do it. The last trick is the last one ..

Change index.shtml:

<Html>
<Body>

<! -- <! -- # Include file = "head.shtml" -->

</Body>

</Html>
 
Add head.shtml at the beginning of the page

<! -- BOM -->

Content

Intention to <! -- # Before include <! -- Comment out the BOM in head.shtml with HTML. There should be no problem in asp.

Two years ago, I found a problem using asp.net include, that is, its interpretation method is completely different from that of asp. If you don't believe it, try it.

<! -- <! -- # Include file = "head.shtml" --> the execution result is equivalent

<! -- # Include file = "head.shtml" -->

I tried for another half an hour and was almost desperate. I was tortured by the small problem of IE. After a random trial, we found

<! -- # <! -- # Include file = "head.shtml" -->

Ignored. For now, look forward to a better solution ..

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.