Charset

The Charset property appends the name of the character set (for example, ISO-LATIN-7) to the content-type header in the response object.

Syntax

Response.Charset(CharsetName)

 

Parameters
CharsetName
A string that specifies a character set for the page. The character set name will be appended to the content-type header in the Response object.
Remarks

This function inserts any string in the header, regardless of whether it represents a valid character set or not.

If a single page contains multiple tags containing Response.Charset, each Response.Charset will replace the previous CharsetName. As a result, the character set will be set to the value specified by the last instance of Response.Charset in the page.

If the codepage of your Web page matches the system defaults of the Web client, you do not need to set a codepage in your Web page. However, setting a codepage is recommended.

If the codepage is set using Response.CodePage, Session.CodePage, @CodePage, or the AspCodePage metabase property, Response.Charset should also be used. The codepage value tells IIS how to encode the data when building the response, and the charset value tells the browser how to decode the data when displaying the response. The CharsetName of Response.Charset must match the codepage value or mixed characters are displayed in the browser. Lists of CharsetNames and matching codepage values can be found at MSDN Web Workshop under the columns for Preferred Charset Label and FamilyCodePage.

If you are writing and testing Web pages that use difference codepages and character sets (for example, creating a multi-lingual Web site), remember that your test client computer must have the language packs installed for each language you wish to display. You can install language packs from Regional Options in the Control Panel.

On Macintosh computers, the default U.S. character set is not ISO-LATIN-1. When serving up documents, Personal Web Server for Macintosh automatically converts from the Macintosh character set to ISO-Latin-1. In the U.S. version, all pages are assumed to be in the U.S. Macintosh character set unless the Response.Charset is used. If Response.Charset is used to change the character set, Personal Web Server for Macintosh does not convert the character set.

Example

For an ASP page that did not include the Response.Charset property, the content-type header would be

content-type:text/html

If the same .asp file included

<% Response.Charset= "ISO-LATIN-7" %>

the content-type header would be

content-type:text/html; charset=ISO-LATIN-7
 
Applies To

Response Object

See Also

CodePage


© 1997-2001 Microsoft Corporation. All rights reserved.