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

ID: Q177382


The information in this article applies to:


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.


Keywords          : 
Version           : WinNT:3.0
Platform          : winnt 
Issue type        : kbbug 

Last Reviewed: May 3, 1999