Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

BUG: Script Encoder Encodes HTML Comments Incorrectly


View products that this article applies to.

This article was previously published under Q264323

↑ Back to the top


Symptoms

When you use the command-line script encoder to encode a page, the page does not display exactly as it had before you encoded it.

↑ Back to the top


Cause

According to the script encoder documentation, script encoder encodes all of the script after the encoding marker (//**Start Encode**). Unfortunately, this also means that the script encoder encodes the closing comment tag (-->), which is contained within the script block. If the comment tag that encases the script block starts before the encoding marker, the script encoder comments out all of the code until it encounters a closing comment tag.

↑ Back to the top


Resolution

To resolve this problem, remove all of the comment tags that are around script blocks before you run the code through the script encoder.

↑ Back to the top


Status

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

↑ Back to the top


More information

Steps to Reproduce Behavior

Save the following HTML page and encode it using the script encoder:
<HTML>
<HEAD>
<SCRIPT>
<!--
//**Start Encode**
function btnclick()
{
     alert("hello world!");
}
-->
</SCRIPT>
<STYLE>
<!--
input#{background-color:darkorange}
-->
</STYLE>
</HEAD>
<BODY>
<INPUT TYPE="button" VALUE="click me" ONCLICK="btnclick()">
</BODY>
</HTML><BR/>
				
Your HTML page should display as follows:
<HTML>
<HEAD>
<SCRIPT language = JScript.Encode>
<!--
//**Start Encode**#@~^TAAAAA==@#@&0;	mDkW	P(Ox1Vrm0`b@#@&	
@#@&~P,PPmsnDD`rtnVsG,hGD^["r#I@#@&8@#@&R @*@#@&QBEAAA==^#~@</SCRIPT>
<STYLE>
<!--
input#{background-color:darkorange}
-->
</STYLE>
</HEAD>
<BODY>
<INPUT TYPE="button" VALUE="click me" ONCLICK="btnclick()">
</BODY>
</HTML>
				
However, the encoded page does not display anything.

↑ Back to the top


References

Script Encoding with the Microsoft Script Engine Version 5.0

For more information on script encoding, see also the following Microsoft Developer Network (MSDN) Web site:

↑ Back to the top


Keywords: kbbug, kbhtml, kbnofix, KB264323

↑ Back to the top

Article Info
Article ID : 264323
Revision : 2
Created on : 5/12/2003
Published on : 5/12/2003
Exists online : False
Views : 359