Re: Why did not subject display normal except English words(like Chinese)

Giganews Newsgroups
Subject: Re: Why did not subject display normal except English words(like Chinese)
Posted by:  Remy Lebeau \(TeamB\) (no.spam@no.spam.com)
Date: Thu, 23 Oct 2008

"kylework2010" <kylework20…@163.com> wrote in message
news:BC4F8F5A0968E340kylework20…@163.com...

>  AMessage.CharSet := 'GB2312';

Setting the Charset property does not actually set up the encoding that
TIdMessage uses for encoding the data.  All it does is sets the
'charset=...' value in the 'Content-Type' header and nothing else.  You have
to use the OnInitializeISO event for the actual encoding, ie:

    AMessage.OnInitializeISO := DoInitializeISO;

    procedure TfrmMessageEditor.DoInitializeISO(var VHeaderEncoding: Char;
var VCharSet: string);
    begin
        VCharSet := 'GB2312';
    end;

>  IdHTML.ContentType := 'text/html;charset=GB2312';

Don't set the Charset like that.  Use the Charset property instead:

    IdHTML.ContentType := 'text/html';
    IdHTML.CharSet := 'GB2312';

>  AMessage.ContentType := 'text/html';

If you are not adding any attachments or other parts, then you should be
using the TIdMessage.Body property instead of a TIdText object.

--
Remy Lebeau (TeamB)

Replies

In response to

Why did not subject display normal except English words(like Chinese) posted by kylework2010 on Thu, 23 Oct 2008