TsgcHTTPServer › 属性 › Charset

Charset 属性

应用于从 DocumentRoot 自动提供的响应的 Content-Type 标头的字符集。

语法

property Charset: string read FCharset write FCharset;

默认值

(空字符串)

备注

每当从 DocumentRoot 自动提供文件时,Charset 会作为 AResponseInfo.Charset 传递给底层的 Indy 响应,以便浏览器知道如何解码文件的字节(例如 utf-8 或 iso-8859-1)。它对您在 OnCommandGet / OnCommandOther 中自行构建的响应没有影响;对于这些情况,请直接在处理程序中设置 AResponseInfo.Charset。将 Charset 留空以使用 Indy 自身的默认值。

示例


oServer := TsgcHTTPServer.Create(nil);
oServer.DocumentRoot := 'c:\www\files';
oServer.Charset := 'utf-8';
oServer.Active := true;

返回属性