The information in this article applies to:
SYMPTOMSInternet Explorer reports an "Invalid character" error when a Unicode .js file is included with the SCRIPT tag, for example:
If the script debugger is enabled, it reports that the first two characters in the .js file (the Unicode Byte Order Mark, or BOM) are the source of the problem.Another closely associated problem occurs if the Byte Order Mark is removed from a Unicode format .js file and the file contains Unicode characters. When the .js file is included during page rendering by Internet Explorer, Unicode characters in the .js file are interpreted as simple ASCII and cause either a script error, as above, or the display of garbage characters. Similarly, removing the BOM from a UTF-8 encoded file containing non-ASCII Unicode characters results in garbage characters being displayed on the rendered Web page. Note that in the Internet Explorer Advanced dialog box (from the Tools menu, select Internet Options), the option Disable script debugging must be cleared or the option Display a notification about every script error must be selected in order to receive a detailed error message for this problem. If these two options are not set correctly, the Internet Explorer status bar indicates that there are errors on the page. The page loads, but the .js file does not. RESOLUTIONIt is possible to work around the problem, in most cases, by embedding Unicode escape sequences in the .js file that is saved in ASCII. For instance, the following JScript statement may be used in an ASCII .js file to specify the Hiragana character NO.
When the ASCII .js file is loaded from the SCRIPT tag there is, of course, no Unicode Byte Order Mark, and the \uXXXX escapes are converted to proper Unicode characters that appear on a Web page.
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. Additional query words: unicode javascript include files
Keywords : kbJScript kbGrpInet kbIE500bug kbDSupport |
Last Reviewed: October 29, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |