Delphi Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

Delphi Examples

Bounced Mail
Bz2
Character Encoding
CSV
DKIM / DomainKey
Digital Certificates
Digital Signatures
DH Key Exchange
DSA
Email
Email Object
FTP
HTML Conversion
HTTP
IMAP
Encryption
MHT / HTML Email
NTLM
POP3
RSA
S/MIME
SMTP
Socket
Spider
SFTP
SSH
SSH Key
SSH Tunnel
String
Tar
Upload
XML
XMP
Zip Compression

More Examples...
Amazon S3
Byte Array
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
Bzip2
LZW

Type Conversion

 

Article: Understanding COM References in Delphi

Convert HTML File to another Character Encoding

Download Chilkat Charset ActiveX

Converts an HTML file from one character encoding to another. Automatically updates the META tag indicating the charset within the HTML. If the FromCharset is not specified, it is obtained from the META tag within the HTML file.

The source/destination charset may be any of the following:
(Scroll down to see source code listing)

us-ascii
unicode
unicodefffe
iso-8859-1
iso-8859-2
iso-8859-3
iso-8859-4
iso-8859-5
iso-8859-6
iso-8859-7
iso-8859-8
iso-8859-9
iso-8859-13
iso-8859-15
windows-874
windows-1250
windows-1251
windows-1252
windows-1253
windows-1254
windows-1255
windows-1256
windows-1257
windows-1258
utf-7
utf-8
utf-32
utf-32be
shift_jis
gb2312
ks_c_5601-1987
big5
iso-2022-jp
iso-2022-kr
euc-jp
euc-kr
macintosh
x-mac-japanese
x-mac-chinesetrad
x-mac-korean
x-mac-arabic
x-mac-hebrew
x-mac-greek
x-mac-cyrillic
x-mac-chinesesimp
x-mac-romanian
x-mac-ukrainian
x-mac-thai
x-mac-ce
x-mac-icelandic
x-mac-turkish
x-mac-croatian
asmo-708
dos-720
dos-862
ibm037
ibm437
ibm500
ibm737
ibm775
ibm850
ibm852
ibm855
ibm857
ibm00858
ibm860
ibm861
ibm863
ibm864
ibm865
cp866
ibm869
ibm870
cp875
koi8-r
koi8-u

uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, StdCtrls,
    ChilkatCharset2Lib_TLB,
    OleCtrls;

...

procedure TForm1.Button1Click(Sender: TObject);
var
charset: TChilkatCharset2;
success: Integer;

begin
charset := TChilkatCharset2.Create(Self);

//  Any string argument automatically begins the 30-day trial.
success := charset.UnlockComponent('30-day trial');
if (success <> 1) then
  begin
    Memo1.Lines.Add(charset.LastErrorText);
    Exit;
  end;

//  If the charset is not specified within an HTML META tag,
//  then assume it's iso-8859-1  (i.e. ANSI for Western-European languages)
charset.FromCharset := 'iso-8859-1';

//  Convert to utf-8.  The file is converted, and the
//  HTML META tag is updated to indicate utf-8.
charset.ToCharset := 'utf-8';

//  Convert the HTML file:
success := charset.ConvertHtmlFile('test.html','test_utf8.html');
if (success <> 1) then
  begin
    Memo1.Lines.Add(charset.LastErrorText);
  end
else
  begin
    Memo1.Lines.Add('Success');
  end;


end;

 

© 2000-2010 Chilkat Software, Inc. All Rights Reserved.

Mail Component · .NET Email Component · XML Parser