FileSystemObject Object in Active Server Pages (ASP) Does Not Correctly Handle DBCS File (177382)



The information in this article applies to:

  • Microsoft Internet Information Server 3.0

This article was previously published under Q177382
We strongly recommend that all users upgrade to Microsoft Internet Information Services (IIS) version 6.0 running on Microsoft Windows Server 2003. IIS 6.0 significantly increases Web infrastructure security. For more information about IIS security-related topics, visit the following Microsoft Web site:

SYMPTOMS

If a simple ASP page uses the following procedures to read a file and write it to another file:
  1. Create a FileSystemObject object.
  2. Open a file using OpenTextFile and assign TristateFalse to "format" parameter (ASCII format).
  3. Read multiple lines from it using Readline.
  4. Write those lines into another file using Writeline.
The expected behavior of the above code is that the contents in the output file should be exactly the same as those in the input file. But if the input file is in Double Byte Character String (DBCS) format, the contents of the output file may not be the same as those in the input file.

CAUSE

The OEM (original equipment manufacturer) code page was incorrectly used to convert strings from Unicode to DBCS and vice versa in Scrrun.dll, while the ANSI code page is the right setting used in place of the OEM code page.

WORKAROUND

To work around this problem, use one of the following methods:

Method 1

  1. Convert the input file to Unicode format using Notepad.exe.
  2. Assign TristateTrue to "format" parameter of OpenTextFile (Unicode format).

Method 2

Apply Microsoft Internet Information Server (IIS) version 4.0, which has the fix to the problem.

STATUS

Microsoft has confirmed this to be a problem in Microsoft Internet Information Server version 3.0. The problem has been corrected in IIS 4.0.

Modification Type:MinorLast Reviewed:6/22/2005
Keywords:kbbug kbQFE KB177382