PRB: Visual InterDev Design-Time Controls Corrupt Unicode and Double-Byte Character Set Data (261154)



The information in this article applies to:

  • Microsoft Visual InterDev 6.0, when used with:
    • Microsoft Internet Information Server 4.0
    • Microsoft Internet Information Services 5.0

This article was previously published under Q261154

SYMPTOMS

Unicode and double-byte character set (DBCS) data become corrupted when you use Visual InterDev Design-Time Controls (DTCs).

CAUSE

Visual InterDev Design-Time Controls use Server.HTMLEncode, an Active Server Pages (ASP) function, to render the control. On Internet Information Services (IIS) 5.0, Server.HTMLEncode incorrectly encodes data that is in a Unicode format, but correctly converts DBCS data. On Internet Information Server (IIS) 4.0 or Personal Web Server (PWS), both Unicode and DBCS data are corrupted.

NOTE: Unicode has been disabled on IIS 4.0 since the release of Microsoft Windows NT Service Pack 4.

MORE INFORMATION

Steps to Reproduce Behavior

Add a Data Connection

NOTE: The data connection in these steps uses the OLE DB Provider for ODBC drivers. However, the same behavior occurs if you use the OLE DB Provider for Microsoft SQL Server.
  1. From the Project menu, select Add Data Connection.
  2. In the Data Link Properties dialog box, select Microsoft OLE DB Provider for ODBC drivers, and then click Next.
  3. Select Use data source name, and then use a data source name that was created to connect to a database.
  4. Type a user name and password. Click Test Connection to make sure that you can connect to your database.

Create an ASP page

  1. In Project Explorer, right-click the project name, select Add, and then select Active Server Page. Specify a name for the page, and then click Open. A new ASP page opens in the source editor.
  2. From the Design-Time Controls toolbox, use a drag-and-drop operation to move a Recordset DTC under the <BODY> tag.
  3. Set the Connection option on the Recordset DTC to the name that you gave your Data Connection when you added it to the project. Select a Database Object of Tables. In the Object Name drop-down list box, select a table from your database.
  4. From the Design-Time Controls toolbox, use a drag-and-drop operation to move a Textbox DTC to the page under the Recordset DTC.
  5. Right-click the Textbox DTC, and click Properties.
  6. In the Data section, set the Recordset property to the name of the Recordset DTC that you added in step 2.
  7. For the Field property, select the name of a field from your database that contains Unicode or DBCS data. Click OK.NOTE: For IIS 5.0, select a field that contains Unicode data. For IIS 4.0 or PWS, select a field that contains DBCS data.

IIS 4.0 and PWS steps to set up the ASP page to handle Chinese characters

  1. Add the ASP CodePage directive to the first line of ASP code as follows:
    <%@ Language=VBScript CodePage=950%>
    					
  2. Insert the following lines of code after the CodePage directive:
    <%Session.CodePage = 950%>
    					
  3. Paste the following code in the HTML <HEAD> section of the ASP page.
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=big5">
    					

IIS 5.0 steps to set up the ASP page to handle Unicode

  1. Add the ASP CodePage directive to the first line of ASP code as follows:
    <%@ Language=VBScript CodePage=65001%>
    					
  2. Insert the following lines of code after the CodePage directive:
    <%Session.CodePage = 65001%>
    					
  3. Paste the following code in the HTML <HEAD> section of the ASP page.
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
    					

REFERENCES

For additional information, click the article numbers below to view the articles in the Microsoft Knowledge Base:

254313 PRB: Error Message: Active Server Pages Error 'ASP 0203' Invalid Code Page

259352 PRB: Server.HTMLEncode Corrupts Unicode Characters and Double-Byte Character Set Data

Please refer to the following Microsoft Developer Network (MSDN) article for more information about charset and code page values:

Modification Type:MajorLast Reviewed:5/29/2003
Keywords:kbCtrl kbLocalization kbprb kbWebServer KB261154