Charset Delphi DLL Reference Documentation

Charset

Current Version: 11.5.0

Deprecated — scheduled for removal

Legacy character-set conversion utilities. Migrate before Chilkat v12.0.0.

Do not use Chilkat.Charset in new development. The entire class is deprecated and is scheduled to be removed in Chilkat v12.0.0. Existing applications should migrate now. Equivalent functionality is available in the free Chilkat.BinData and Chilkat.StringBuilder classes.

Chilkat.Charset is a legacy class for converting text between character encodings, reading and writing encoded text files, inspecting or rewriting HTML charset declarations, encoding and decoding HTML entities, validating byte sequences, and performing several older text utilities. It remains documented only to support maintenance and migration of existing applications.

Use BinData for bytes

Store raw bytes, load and save files, append byte-order marks, and move encoded data between files, memory, and other Chilkat objects.

Use StringBuilder for text

Hold Unicode text and perform charset encoding or decoding, URL processing, HTML entity conversion, case conversion, and related text operations.

Prefer UTF-8

For new text formats and interchange, use UTF-8 unless a protocol or legacy system explicitly requires another encoding.

Keep bytes and characters distinct

A charset defines how text characters map to bytes. Binary encodings such as Base64 or hexadecimal solve a different problem and are not character sets.

Legacy HTML helpers

The class can inspect and rewrite HTML charset metadata, but these helpers do not validate that declared metadata matches the actual bytes.

Maintenance only

Continue using this class only while maintaining older code, and plan a tested migration before adopting Chilkat v12.

Migration pattern: load encoded bytes into BinData, decode them into a StringBuilder using the known source charset, work with Unicode text, then encode back into BinData using the required destination charset. This makes the boundary between bytes and text explicit and replaces the stateful FromCharset/ToCharset workflow.

Create/Dispose

var
myObject: HCkCharset;

begin
myObject := CkCharset_Create();

// ...

CkCharset_Dispose(myObject);
end;
function CkCharset_Create: HCkCharset; stdcall;

Creates an instance of the HCkCharset object and returns a handle (i.e. a Pointer). The handle is passed in the 1st argument for the functions listed on this page.

procedure CkCharset_Dispose(handle: HCkCharset); stdcall;

Objects created by calling CkCharset_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function.

Properties

AltToCharset
procedure CkCharset_getAltToCharset(objHandle: HCkCharset; outPropVal: HCkString); stdcall;
procedure CkCharset_putAltToCharset(objHandle: HCkCharset; newPropVal: PWideChar); stdcall;
function CkCharset__altToCharset(objHandle: HCkCharset): PWideChar; stdcall;

Specifies the alternate destination character encoding used only when ErrorAction is 6.

If a decoded input character cannot be represented in ToCharset, Chilkat attempts to encode that character using this alternate charset. If the alternate conversion also fails, the character is omitted from the output.

Mixed-encoding output: The result can contain a mixture of byte encodings. Such output is usually unsuitable for interchange unless the receiving format explicitly supports this behavior.

See the notes about PWideChar memory ownership and validity.

top
DebugLogFilePath
procedure CkCharset_getDebugLogFilePath(objHandle: HCkCharset; outPropVal: HCkString); stdcall;
procedure CkCharset_putDebugLogFilePath(objHandle: HCkCharset; newPropVal: PWideChar); stdcall;
function CkCharset__debugLogFilePath(objHandle: HCkCharset): PWideChar; stdcall;

If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. This logging helps identify the context and history of Chilkat calls leading up to any crash or hang, aiding in debugging.

Enabling the VerboseLogging property provides more detailed information. This property is mainly used for debugging rare instances where a Chilkat method call causes a hang or crash, which should generally not happen.

Possible causes of hangs include:

  • A timeout property set to 0, indicating an infinite timeout.
  • A hang occurring within an event callback in the application code.
  • An internal bug in the Chilkat code causing the hang.

See the notes about PWideChar memory ownership and validity.

More Information and Examples
top
ErrorAction
function CkCharset_getErrorAction(objHandle: HCkCharset): Integer; stdcall;
procedure CkCharset_putErrorAction(objHandle: HCkCharset; newPropVal: Integer); stdcall;

Controls what happens when an input character has been decoded successfully but cannot be represented in the destination charset.

ValueAction
0Drop the unrepresentable character.
1Insert the replacement configured by SetErrorString.
2Emit a hexadecimal numeric character reference such as €.
35Reserved. Do not use.
6Encode the character using AltToCharset; drop it if that also fails.
7Pass the nonconvertible data through unchanged.
Data-integrity warning: Values 0, 6, and 7 can silently lose data or produce output that is not valid in the declared destination charset. For new code, prefer an explicit failure or replacement policy in the replacement API.

top
FromCharset
procedure CkCharset_getFromCharset(objHandle: HCkCharset; outPropVal: HCkString); stdcall;
procedure CkCharset_putFromCharset(objHandle: HCkCharset; newPropVal: PWideChar); stdcall;
function CkCharset__fromCharset(objHandle: HCkCharset): PWideChar; stdcall;

Specifies the character encoding of the input bytes for conversion operations. Chilkat decodes the source bytes using this charset before encoding the resulting Unicode text using ToCharset.

FamilyRecognized names
Unicode and ASCIIus-ascii, utf-7, utf-8, unicode / utf-16 / utf-16le, unicodefffe / utf-16be, utf-32, utf-32be
ISO and Windowsiso-8859-1, -2, -3, -4, -5, -6, -7, -8, -9, -13, -15; windows-874, windows-1250 through windows-1258
East Asianshift_jis, gb2312, ks_c_5601-1987, big5, iso-2022-jp, iso-2022-kr, euc-jp, euc-kr
Macintoshmacintosh, 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
DOS, IBM, and legacyebcdic, asmo-708, dos-720, dos-862, ibm01140 through ibm01149, ibm037, ibm437, ibm500, ibm737, ibm775, ibm850, ibm852, ibm855, ibm857, ibm00858, ibm860, ibm861, ibm863, ibm864, ibm865, cp866, ibm869, ibm870, cp875, koi8-r, koi8-u
Source encoding: unicode, utf-16, and utf-16le identify little-endian UTF-16. unicodefffe and utf-16be identify big-endian UTF-16. Except where a method explicitly documents HTML metadata detection, set the source charset explicitly rather than assuming automatic detection.

See the notes about PWideChar memory ownership and validity.

top
LastErrorHtml
procedure CkCharset_getLastErrorHtml(objHandle: HCkCharset; outPropVal: HCkString); stdcall;
function CkCharset__lastErrorHtml(objHandle: HCkCharset): PWideChar; stdcall;

Provides HTML-formatted information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.

See the notes about PWideChar memory ownership and validity.

top
LastErrorText
procedure CkCharset_getLastErrorText(objHandle: HCkCharset; outPropVal: HCkString); stdcall;
function CkCharset__lastErrorText(objHandle: HCkCharset): PWideChar; stdcall;

Provides plain text information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.

See the notes about PWideChar memory ownership and validity.

top
LastErrorXml
procedure CkCharset_getLastErrorXml(objHandle: HCkCharset; outPropVal: HCkString); stdcall;
function CkCharset__lastErrorXml(objHandle: HCkCharset): PWideChar; stdcall;

Provides XML-formatted information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.

See the notes about PWideChar memory ownership and validity.

top
LastInputAsHex
procedure CkCharset_getLastInputAsHex(objHandle: HCkCharset; outPropVal: HCkString); stdcall;
function CkCharset__lastInputAsHex(objHandle: HCkCharset): PWideChar; stdcall;

Returns the input bytes captured for the most recent conversion performed while SaveLast was enabled, represented as hexadecimal text.

Diagnostic snapshot: This is a diagnostic representation of the raw bytes. It does not perform another charset conversion, and the quoted-printable form is intended to make otherwise nonprintable bytes easier to inspect.

See the notes about PWideChar memory ownership and validity.

top
LastInputAsQP
procedure CkCharset_getLastInputAsQP(objHandle: HCkCharset; outPropVal: HCkString); stdcall;
function CkCharset__lastInputAsQP(objHandle: HCkCharset): PWideChar; stdcall;

Returns the input bytes captured for the most recent conversion performed while SaveLast was enabled, represented as quoted-printable text.

Diagnostic snapshot: This is a diagnostic representation of the raw bytes. It does not perform another charset conversion, and the quoted-printable form is intended to make otherwise nonprintable bytes easier to inspect.

See the notes about PWideChar memory ownership and validity.

top
LastMethodSuccess
function CkCharset_getLastMethodSuccess(objHandle: HCkCharset): wordbool; stdcall;
procedure CkCharset_putLastMethodSuccess(objHandle: HCkCharset; newPropVal: wordbool); stdcall;

Indicates the success or failure of the most recent method call: True means success, False means failure. This property remains unchanged by property setters or getters. This method is present to address challenges in checking for null or Nothing returns in certain programming languages. Note: This property does not apply to methods that return integer values or to boolean-returning methods where the boolean does not indicate success or failure.

top
LastOutputAsHex
procedure CkCharset_getLastOutputAsHex(objHandle: HCkCharset; outPropVal: HCkString); stdcall;
function CkCharset__lastOutputAsHex(objHandle: HCkCharset): PWideChar; stdcall;

Returns the output bytes captured for the most recent conversion performed while SaveLast was enabled, represented as hexadecimal text.

Diagnostic snapshot: This is a diagnostic representation of the raw bytes. It does not perform another charset conversion, and the quoted-printable form is intended to make otherwise nonprintable bytes easier to inspect.

See the notes about PWideChar memory ownership and validity.

top
LastOutputAsQP
procedure CkCharset_getLastOutputAsQP(objHandle: HCkCharset; outPropVal: HCkString); stdcall;
function CkCharset__lastOutputAsQP(objHandle: HCkCharset): PWideChar; stdcall;

Returns the output bytes captured for the most recent conversion performed while SaveLast was enabled, represented as quoted-printable text.

Diagnostic snapshot: This is a diagnostic representation of the raw bytes. It does not perform another charset conversion, and the quoted-printable form is intended to make otherwise nonprintable bytes easier to inspect.

See the notes about PWideChar memory ownership and validity.

top
SaveLast
function CkCharset_getSaveLast(objHandle: HCkCharset): wordbool; stdcall;
procedure CkCharset_putSaveLast(objHandle: HCkCharset; newPropVal: wordbool); stdcall;

When True, retains the input and output byte sequences from each conversion so they can be inspected through LastInputAsHex, LastInputAsQP, LastOutputAsHex, and LastOutputAsQP.

Debugging only: Enable this only while troubleshooting. Retaining both sides of a large conversion increases memory use and may keep sensitive plaintext in memory longer than necessary.

top
ToCharset
procedure CkCharset_getToCharset(objHandle: HCkCharset; outPropVal: HCkString); stdcall;
procedure CkCharset_putToCharset(objHandle: HCkCharset; newPropVal: PWideChar); stdcall;
function CkCharset__toCharset(objHandle: HCkCharset): PWideChar; stdcall;

Specifies the destination character encoding for conversion operations. After decoding the source bytes using FromCharset, Chilkat encodes the resulting Unicode text in this charset.

FamilyRecognized names
Unicode and ASCIIus-ascii, utf-7, utf-8, unicode / utf-16 / utf-16le, unicodefffe / utf-16be, utf-32, utf-32be
ISO and Windowsiso-8859-1, -2, -3, -4, -5, -6, -7, -8, -9, -13, -15; windows-874, windows-1250 through windows-1258
East Asianshift_jis, gb2312, ks_c_5601-1987, big5, iso-2022-jp, iso-2022-kr, euc-jp, euc-kr
Macintoshmacintosh, 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
DOS, IBM, and legacyebcdic, asmo-708, dos-720, dos-862, ibm01140 through ibm01149, ibm037, ibm437, ibm500, ibm737, ibm775, ibm850, ibm852, ibm855, ibm857, ibm00858, ibm860, ibm861, ibm863, ibm864, ibm865, cp866, ibm869, ibm870, cp875, koi8-r, koi8-u
Choosing an output encoding: For new text interchange, utf-8 is normally the preferred destination. Legacy single-byte encodings cannot represent every Unicode character; ErrorAction controls how such conversion failures are handled.

See the notes about PWideChar memory ownership and validity.

top
VerboseLogging
function CkCharset_getVerboseLogging(objHandle: HCkCharset): wordbool; stdcall;
procedure CkCharset_putVerboseLogging(objHandle: HCkCharset; newPropVal: wordbool); stdcall;

If set to True, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. The default value is False. Verbose logging should only be used for debugging. The potentially large quantity of logged information may adversely affect peformance.

top
Version
procedure CkCharset_getVersion(objHandle: HCkCharset; outPropVal: HCkString); stdcall;
function CkCharset__version(objHandle: HCkCharset): PWideChar; stdcall;

Version of the component/library, such as "10.1.0"

See the notes about PWideChar memory ownership and validity.

More Information and Examples
top

Methods

CharsetToCodePage
function CkCharset_CharsetToCodePage(objHandle: HCkCharset;
    charsetName: PWideChar): Integer; stdcall;

Returns the numeric Windows code-page identifier corresponding to charsetName. For example, iso-8859-1 maps to 28591, and utf-8 maps to 65001.

Code pages: A code page number is a legacy Windows identifier for a character encoding. Internet protocols and modern APIs normally use charset names such as utf-8 rather than numeric code pages.
top
CodePageToCharset
function CkCharset_CodePageToCharset(objHandle: HCkCharset;
    codePage: Integer;
    outCharset: HCkString): wordbool; stdcall;
function CkCharset__codePageToCharset(objHandle: HCkCharset;
    codePage: Integer): PWideChar; stdcall;

Returns the charset name corresponding to the numeric code-page identifier in codePage. For example, 65001 maps to utf-8. The operation fails when the code page is not recognized.

Name normalization: Different aliases can identify the same encoding. The returned value is Chilkat’s canonical name for the recognized code page, not necessarily the alias originally used by another application.

Returns True for success, False for failure.

See the notes about PWideChar memory ownership and validity.

top
ConvertFile
function CkCharset_ConvertFile(objHandle: HCkCharset;
    inPath: PWideChar;
    destPath: PWideChar): wordbool; stdcall;

Reads the file at inPath, converts its text from FromCharset to ToCharset, and writes the converted bytes to the file at destPath.

When the destination charset is utf-8 or utf-16, this method writes the corresponding byte-order mark (BOM) at the beginning of the output. Use ConvertFileNoPreamble when the output must not contain a BOM.

BOM behavior: A BOM is a leading byte sequence that can identify a Unicode encoding or byte order. UTF-8 does not require a BOM, and many modern formats prefer UTF-8 without one.

Returns True for success, False for failure.

top
ConvertFileNoPreamble
function CkCharset_ConvertFileNoPreamble(objHandle: HCkCharset;
    inPath: PWideChar;
    destPath: PWideChar): wordbool; stdcall;

Reads the file at inPath, converts its text from FromCharset to ToCharset, and writes the converted bytes to destPath without adding a byte-order mark or other encoding preamble.

UTF-8 output: This is generally the appropriate choice for UTF-8 files unless the consuming system specifically requires a UTF-8 BOM.
top
ConvertHtmlFile
function CkCharset_ConvertHtmlFile(objHandle: HCkCharset;
    inPath: PWideChar;
    destPath: PWideChar): wordbool; stdcall;

Converts the HTML file at inPath to ToCharset and writes the result to destPath. Chilkat also updates the HTML <meta> charset declaration to identify the destination encoding.

If FromCharset is empty, Chilkat attempts to obtain the source charset from an HTML <meta> declaration. Otherwise, the explicitly configured source charset is used.

Detection limitation: A declared charset is metadata, not proof of the file’s actual encoding. Incorrect or missing declarations can cause decoding errors; use an explicit source charset when it is known.

Returns True for success, False for failure.

top
EntityEncodeDec
function CkCharset_EntityEncodeDec(objHandle: HCkCharset;
    str: PWideChar;
    outStr: HCkString): wordbool; stdcall;
function CkCharset__entityEncodeDec(objHandle: HCkCharset;
    str: PWideChar): PWideChar; stdcall;

Returns str with each non-US-ASCII character replaced by a decimal HTML/XML numeric character reference. For example, é becomes &#233;.

Entity encoding: Numeric character references describe Unicode characters; they are not a character-set conversion and do not make arbitrary binary data safe for HTML.

Returns True for success, False for failure.

See the notes about PWideChar memory ownership and validity.

top
EntityEncodeHex
function CkCharset_EntityEncodeHex(objHandle: HCkCharset;
    str: PWideChar;
    outStr: HCkString): wordbool; stdcall;
function CkCharset__entityEncodeHex(objHandle: HCkCharset;
    str: PWideChar): PWideChar; stdcall;

Returns str with each non-US-ASCII character replaced by a hexadecimal HTML/XML numeric character reference. For example, é becomes &#xE9;.

Entity encoding: Decimal and hexadecimal numeric references represent the same Unicode character; only the textual notation differs.

Returns True for success, False for failure.

See the notes about PWideChar memory ownership and validity.

top
GetHtmlFileCharset
function CkCharset_GetHtmlFileCharset(objHandle: HCkCharset;
    htmlFilePath: PWideChar;
    outCharset: HCkString): wordbool; stdcall;
function CkCharset__getHtmlFileCharset(objHandle: HCkCharset;
    htmlFilePath: PWideChar): PWideChar; stdcall;

Examines the HTML file at htmlFilePath and returns the charset name declared by an HTML <meta> element, when present.

Metadata only: The method reads document metadata only. A missing, stale, or incorrect declaration does not reveal the file’s true encoding.

Returns True for success, False for failure.

See the notes about PWideChar memory ownership and validity.

top
HtmlDecodeToStr
function CkCharset_HtmlDecodeToStr(objHandle: HCkCharset;
    inStr: PWideChar;
    outStr: HCkString): wordbool; stdcall;
function CkCharset__htmlDecodeToStr(objHandle: HCkCharset;
    inStr: PWideChar): PWideChar; stdcall;

Decodes HTML named entities and numeric character references in inStr and returns the resulting Unicode string. Examples include &lt;, &amp;, &#233;, and &#xE9;.

Security context: Entity decoding is a text transformation, not HTML parsing or sanitization. Decoding untrusted text can reintroduce markup-significant characters such as <, >, and &.

Returns True for success, False for failure.

See the notes about PWideChar memory ownership and validity.

top
HtmlEntityDecodeFile
function CkCharset_HtmlEntityDecodeFile(objHandle: HCkCharset;
    inPath: PWideChar;
    destPath: PWideChar): wordbool; stdcall;

Reads the file at inPath, decodes HTML named entities and numeric character references, and writes the transformed content to destPath.

Content transformation: The output may contain literal markup-significant characters that were previously escaped. This operation does not parse, validate, or sanitize HTML.

Returns True for success, False for failure.

top
LowerCase
function CkCharset_LowerCase(objHandle: HCkCharset;
    inStr: PWideChar;
    outStr: HCkString): wordbool; stdcall;
function CkCharset__lowerCase(objHandle: HCkCharset;
    inStr: PWideChar): PWideChar; stdcall;

Returns the lowercase form of inStr using Chilkat’s Unicode case conversion.

Unicode casing: Case conversion can change string length and is not the same operation as locale-aware collation or case-insensitive comparison.

Returns True for success, False for failure.

See the notes about PWideChar memory ownership and validity.

top
ReadFileToString
function CkCharset_ReadFileToString(objHandle: HCkCharset;
    path: PWideChar;
    charset: PWideChar;
    outStr: HCkString): wordbool; stdcall;
function CkCharset__readFileToString(objHandle: HCkCharset;
    path: PWideChar;
    charset: PWideChar): PWideChar; stdcall;

Reads the text file at path, decodes its bytes using the charset named by charset, and returns the resulting Unicode string.

Charset must match the file: The caller must supply the actual source encoding. Choosing the wrong charset can produce replacement characters or silently incorrect text even when the file can be decoded.

Returns True for success, False for failure.

See the notes about PWideChar memory ownership and validity.

top
SetErrorString
procedure CkCharset_SetErrorString(objHandle: HCkCharset;
    str: PWideChar;
    charset: PWideChar) stdcall;

Configures the replacement used when ErrorAction is 1. str is the replacement text, and charset identifies the charset used to encode that replacement into the conversion output.

Replacement behavior: Choose replacement text that is representable in the specified charset. A common replacement is ?, but explicit error handling is safer when data loss is unacceptable.
top
UpperCase
function CkCharset_UpperCase(objHandle: HCkCharset;
    inStr: PWideChar;
    outStr: HCkString): wordbool; stdcall;
function CkCharset__upperCase(objHandle: HCkCharset;
    inStr: PWideChar): PWideChar; stdcall;

Returns the uppercase form of inStr using Chilkat’s Unicode case conversion.

Unicode casing: Case conversion can change string length and is not the same operation as locale-aware collation or case-insensitive comparison.

Returns True for success, False for failure.

See the notes about PWideChar memory ownership and validity.

top
UrlDecodeStr
function CkCharset_UrlDecodeStr(objHandle: HCkCharset;
    inStr: PWideChar;
    outStr: HCkString): wordbool; stdcall;
function CkCharset__urlDecodeStr(objHandle: HCkCharset;
    inStr: PWideChar): PWideChar; stdcall;

Percent-decodes inStr and interprets the resulting bytes using the platform’s legacy ANSI character encoding.

For example, in a Western Windows code page, %C9 may decode as É. UTF-8 input would encode the same character as %C3%89 and is therefore not handled correctly by this legacy assumption.

Legacy ANSI behavior: Do not use this method for modern URLs or form data unless the data is known to use the applicable ANSI code page. Use StringBuilder URL decoding with an explicit charset, normally utf-8.

Returns True for success, False for failure.

See the notes about PWideChar memory ownership and validity.

top
VerifyFile
function CkCharset_VerifyFile(objHandle: HCkCharset;
    charset: PWideChar;
    path: PWideChar): wordbool; stdcall;

Returns True when the contents of the file at path form a valid byte sequence for the charset named by charset; otherwise returns False.

Validation limitation: A successful result means only that the bytes are structurally valid for that encoding. It does not identify the encoding or confirm that the decoded text is semantically correct.
top
WriteStringToFile
function CkCharset_WriteStringToFile(objHandle: HCkCharset;
    textData: PWideChar;
    path: PWideChar;
    charset: PWideChar): wordbool; stdcall;

Encodes the Unicode text in textData using the charset named by charset and writes the resulting bytes to the file at path.

Destination encoding: The charset argument is the third parameter. Select utf-8 for modern interchange unless a receiving system requires a specific legacy encoding.

Returns True for success, False for failure.

top

Deprecated

ConvertData Deprecated
function CkCharset_ConvertData(objHandle: HCkCharset;
    inData: HCkByteData;
    outData: HCkByteData): wordbool; stdcall;

Converts the bytes in inData from FromCharset to ToCharset and returns the converted bytes.

Returns True for success, False for failure.

top
ConvertFromUnicode Deprecated
function CkCharset_ConvertFromUnicode(objHandle: HCkCharset;
    inData: PWideChar;
    outBytes: HCkByteData): wordbool; stdcall;

Encodes the Unicode string in inData using ToCharset and returns the resulting bytes.

Returns True for success, False for failure.

top
ConvertFromUtf16 Deprecated
function CkCharset_ConvertFromUtf16(objHandle: HCkCharset;
    uniData: HCkByteData;
    outMbData: HCkByteData): wordbool; stdcall;

Converts the UTF-16 byte sequence in uniData to the character encoding specified by ToCharset and returns the resulting bytes.

Returns True for success, False for failure.

top
ConvertHtml Deprecated
function CkCharset_ConvertHtml(objHandle: HCkCharset;
    inData: HCkByteData;
    outHtml: HCkByteData): wordbool; stdcall;

Converts HTML bytes in inData from FromCharset to ToCharset. The returned bytes contain the converted HTML, and Chilkat updates the HTML <meta> charset declaration to identify the destination encoding.

HTML charset declarations: Updating a <meta charset> declaration does not change HTTP response headers. When serving the converted file over HTTP, the server’s Content-Type charset must agree with the actual bytes.

Returns True for success, False for failure.

top
ConvertToUnicode Deprecated
function CkCharset_ConvertToUnicode(objHandle: HCkCharset;
    inData: HCkByteData;
    outStr: HCkString): wordbool; stdcall;
function CkCharset__convertToUnicode(objHandle: HCkCharset;
    inData: HCkByteData): PWideChar; stdcall;

Decodes the bytes in inData using FromCharset and returns the resulting Unicode string.

Returns True for success, False for failure.

See the notes about PWideChar memory ownership and validity.

top
ConvertToUtf16 Deprecated
function CkCharset_ConvertToUtf16(objHandle: HCkCharset;
    mbData: HCkByteData;
    outUniData: HCkByteData): wordbool; stdcall;

Decodes the bytes in mbData using FromCharset and returns the text encoded as UTF-16 bytes.

Returns True for success, False for failure.

top
GetHtmlCharset Deprecated
function CkCharset_GetHtmlCharset(objHandle: HCkCharset;
    inData: HCkByteData;
    outCharset: HCkString): wordbool; stdcall;
function CkCharset__getHtmlCharset(objHandle: HCkCharset;
    inData: HCkByteData): PWideChar; stdcall;

Examines the HTML bytes in inData and returns the charset name declared by an HTML <meta> element, when present.

Metadata only: This reports the declaration found in the document. It does not verify that the bytes actually use that encoding, and it does not inspect an HTTP Content-Type header.

Returns True for success, False for failure.

See the notes about PWideChar memory ownership and validity.

top
HtmlEntityDecode Deprecated
function CkCharset_HtmlEntityDecode(objHandle: HCkCharset;
    inHtml: HCkByteData;
    outData: HCkByteData): wordbool; stdcall;

Decodes HTML entities and numeric character references in the byte data supplied in inHtml and returns the resulting bytes.

Operation scope: Entity decoding is not a charset conversion and does not sanitize HTML.

Returns True for success, False for failure.

top
ReadFile Deprecated
function CkCharset_ReadFile(objHandle: HCkCharset;
    path: PWideChar;
    outData: HCkByteData): wordbool; stdcall;

Reads the entire file at path and returns its raw bytes without performing charset conversion.

Returns True for success, False for failure.

top
VerifyData Deprecated
function CkCharset_VerifyData(objHandle: HCkCharset;
    charset: PWideChar;
    inData: HCkByteData): wordbool; stdcall;

Returns True when the bytes in inData form a valid sequence for the charset named by charset; otherwise returns False.

What validation means: This checks encoding validity only. It does not prove that the selected charset is the intended one. For many single-byte encodings, every possible byte value is valid.
top
WriteFile Deprecated
function CkCharset_WriteFile(objHandle: HCkCharset;
    path: PWideChar;
    byteData: HCkByteData): wordbool; stdcall;

Writes all bytes from byteData to the file at path without performing charset conversion.

top