BUG: Script Encoder Encodes HTML Comments Incorrectly (264323)



The information in this article applies to:

  • Microsoft Internet Explorer (Programming) 4.01 SP1
  • Microsoft Internet Explorer (Programming) 4.01 SP2
  • Microsoft Internet Explorer (Programming) 5
  • Microsoft Internet Explorer (Programming) 5.01
  • Microsoft Internet Explorer (Programming) 5.01 SP1
  • Microsoft Internet Explorer (Programming) 5.5

This article was previously published under Q264323

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.

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.

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.

STATUS

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

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.

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:

Modification Type:MajorLast Reviewed:5/12/2003
Keywords:kbBug kbhtml kbnofix KB264323