Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
|
Convert HTML File to another Character EncodingConverts 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: us-ascii
import com.chilkatsoft.*; public class ChilkatExample { static { try { System.loadLibrary("chilkat"); } catch (UnsatisfiedLinkError e) { System.err.println("Native code library failed to load.\n" + e); System.exit(1); } } public static void main(String argv[]) { CkCharset charset = new CkCharset(); // Any string argument automatically begins the 30-day trial. boolean success; success = charset.UnlockComponent("30-day trial"); if (success != true) { System.out.println(charset.lastErrorText()); return; } // 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.put_FromCharset("iso-8859-1"); // Convert to utf-8. The file is converted, and the // HTML META tag is updated to indicate utf-8. charset.put_ToCharset("utf-8"); // Convert the HTML file: success = charset.ConvertHtmlFile("test.html","test_utf8.html"); if (success != true) { System.out.println(charset.lastErrorText()); } else { System.out.println("Success"); } } } |
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.