
362
|
Chapter 17: The HttpResponse Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Charset
String = Response.Charset
Response.Charset = String
Returns or sets a string representing the character set of the current response.
When explicitly set, the value assigned to the Charset property is added to the
HTTP Content-Type response header.
Parameter
String
A string variable to receive or set the value of the property. The default is
UTF-8.
Example
The example below sets the character set for the HTTP response to Windows-
1255 (note that as the name suggests, this character set is only available on
Internet Explorer on Windows clients and may cause other browsers or browsers
on other operating systems to display the page incorrectly). It then writes the
value of the character set to the Text property of the Message label control. To see
the difference between this character set and the default UTF-8 character set, load
the page into Internet Explorer, and comment out the line that sets the Charset
property, save the page, and reload it in the browser.
Sub Page_Load( )
Response.Charset = "Windows-1255"
Message.Text = "Current character set is " & Response.Charset
End Sub
Notes
Attempting to modify this property after the HTTP headers are sent to the
browser results in an HttpException being thrown. This would most likely occur
if you disabled ...