Microsoft KB Archive/298790

= BUG: Script Encoder Does Not Decode Properly When Locale Changes =

Article ID: 298790

Article Last Modified on 5/11/2006

-

APPLIES TO


 * Microsoft Internet Explorer 4.0 128-Bit Edition
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 4.01 Service Pack 1
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 5.0
 * Microsoft Internet Explorer 5.01
 * Microsoft Internet Explorer (Programming) 5.01 SP1
 * Microsoft Internet Explorer 5.5
 * Microsoft Internet Explorer (Programming) 5.5 SP1
 * Microsoft Internet Explorer (Programming) 5.5 SP2
 * Microsoft Internet Explorer (Programming) 6.0
 * Microsoft Internet Explorer (Programming) 6 (SP1)

-



This article was previously published under Q298790



SYMPTOMS
When script is encoded on a computer from one locale and then decoded on a computer from a different locale, the decoding can produce unexpected results.



CAUSE
The encoding only affects the ASCII range of characters (0-127) and does not change the characters outside of this range. Specifically, this problem occurs when you transition between English and Asian languages because a non-ASCII character in English may be the leading character of a multibyte sequence in an Asian language. This can cause ambiguous results.



RESOLUTION
To work around this problem, use one of the following methods:
 * 1) Load the HTML/ASP file in Notepad. Save the file in Unicode format instead of the default ANSI format. To do this, click Unicode in the Encoding drop-down list box at the bottom of the Save As dialog box).
 * 2) Locate scripts on the server so that the client only refers to these scripts, and no encoding is present.



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



Steps to Reproduce Behavior
 Create a new HTML document with the following line in a script tag:

&quot;!#$%&'-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`abcdefghijklmnopqrstuvwxyz&quot;...''&quot;&quot;{}~--(tm) (c)&quot;(r)&quot;1/43/41/2&quot;

 In Windows Script Encoder, type the following command in an English Windows-based system to encode the HTML document that contains the preceding line:

screnc Test.htm encodedTest.htm

 In Internet Explorer, try to load the encoded script file on a computer that is set to use an Asian language (for example, Japanese, Chinese, or Korean).

Although you do not receive an error message from the code as expected, you receive an error message on the Asian language computer (which appears in the particular language):

Line 1, Character 1. Expected statement 800a0400 Source Microsoft VB script compilation error.



