CkCharset Java Programming Reference Documentation
CkCharset
A component/class for converting character data from one encoding to another. This software is unique in that the data required for converting to/from the supported charsets is entirely embedded witin the Chilkat DLL/library. It does not depend on what code pages may or may not be installed on a particular computer. This allows programs to operate correctly regardless of the locale, OS version, or other factors.
Properties
// str is a CkString object (output) get_AltToCharset( str )
// charsetName is a string (input) put_AltToCharset( charsetName )
If the ErrorAction property is set to 6, then this property controls how errors are handled. It specifies an alternate "To" charset. When a character in the input data cannot be converted to the target charset, an attempt is made to convert it to the AltToCharset. If that fails, the input character is dropped.
// Returns an integer value get_ErrorAction( )
// val is an integer (input) put_ErrorAction( val )
Controls how errors are handled. When a character in the input data cannot be converted to the target charset, the action taken is controlled by this property. The possible settings are: (0) drop the error characters, (1) substitute the data set by the SetErrorBytes or SetErrorString method, (2) convert to a hex-escaped string (XXXX), (3) RESERVED, (4) RESERVED, (5) RESERVED, (6) convert the error character to the AltToCharset instead, if that fails then drop the character, (7) Pass non-convertible characters to the output unchanged.
// str is a CkString object (output) // Returns a boolean value get_FromCharset( str )
// charset is a string (input) // Returns a boolean value put_FromCharset( charset )
Tells the charset converter the charset of the input data for a conversion. Possible values are:
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
// str is a CkString object (output) LastErrorHtml( str )
Error information in HTML format for the last method called.
// str is a CkString object (output) LastErrorText( str )
Error information in plain-text format for the last method called.
// str is a CkString object (output) LastErrorXml( str )
Error information in XML format for the last method called.
// str is a CkString object (output) // Returns a boolean value get_LastInputAsHex( str )
If SaveLast is set to true, then the input and output of a conversion is saved to allow the exact bytes that are sent to the converter to be seen (for debugging purposes). This property shows the last input data in a hexidecimalized string.
// str is a CkString object (output) // Returns a boolean value get_LastInputAsQP( str )
If SaveLast is set to true, then the input and output of a conversion is saved to allow the exact bytes that are sent to the converter to be seen (for debugging purposes). This property shows the last input data in a quoted-printable string.
// str is a CkString object (output) // Returns a boolean value get_LastOutputAsHex( str )
If SaveLast is set to true, then the input and output of a conversion is saved to allow the exact bytes that are sent to the converter to be seen (for debugging purposes). This property shows the last output data in a hexidecimalized string.
// str is a CkString object (output) // Returns a boolean value get_LastOutputAsQP( str )
If SaveLast is set to true, then the input and output of a conversion is saved to allow the exact bytes that are sent to the converter to be seen (for debugging purposes). This property shows the last output data in a quoted-printable string.
// Returns a boolean value get_SaveLast( )
// value is a boolean (input) put_SaveLast( value )
Tells the component to keep the input/output byte data in memory after a conversion is complete so the data can be examined via the LastInputAsHex/QP and LastOutputAsHex/QP properties. (for debugging purposes)
// str is a CkString object (output) // Returns a boolean value get_ToCharset( str )
// charset is a string (input) // Returns a boolean value put_ToCharset( charset )
Tells the charset converter the target charset for a conversion. Possible values are:
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
// str is a CkString object (output) // Returns a boolean value get_Version( str )
Returns the version of the component, such as "9.0.0"
Methods
// charsetName is a string (input) // Returns an integer value CharsetToCodePage( charsetName )
Converts a charset name to a code page number. For example, "iso-8859-1" converts to code page 28591.
// codePage is an integer (input) // sCharset is a CkString object (output) // Returns a boolean value CodePageToCharset( codePage, sCharset )
Converts a code page number to a charset name. For example, 65001 converts to "utf-8". Returns true for success, false for failure.
// inData is a CkByteData object (input) // outData is a CkByteData object (output) // Returns a boolean value ConvertData( inData, outData )
Converts character data from one charset to another. Before calling ConvertData, the FromCharset and ToCharset properties must be set to the source and destination charset names, such as "iso-8859-1" or "Shift_JIS".
// inFilename is a string (input) // outFilename is a string (input) // Returns a boolean value ConvertFile( inFilename, outFilename )
Converts a file from one character encoding to another. The FromCharset and ToCharset properties must be set to the source and destination character encodings before calling this method.
// uniData is a CkByteData object (input) // mbData is a CkByteData object (output) // Returns a boolean value ConvertFromUnicode( uniData, mbData )
Converts Unicode text to the charset specified by the ToCharset property.
// htmlIn is a CkByteData object (input) // htmlOut is a CkByteData object (output) // Returns a boolean value ConvertHtml( htmlIn, htmlOut )
Converts HTML text from one character encoding to another. The FromCharset and ToCharset properties must be set prior to calling this method. This method automatically edits the META tag within the HTML that indicates the charset.
// inFilename is a string (input) // outFilename is a string (input) // Returns a boolean value ConvertHtmlFile( inFilename, outFilename )
Converts an HTML file from one character encoding to another. The FromCharset and ToCharset properties must be set prior to calling this method. This method automatically edits the META tag within the HTML that indicates the charset.
// mbData is a CkByteData object (input) // uniData is a CkByteData object (output) // Returns a boolean value ConvertToUnicode( mbData, uniData )
Converts multibyte character data to a Unicode string. The FromCharset property should be set before calling this method.
// inStr is a string (input) // outStr is a CkString object (output) EntityEncodeDec( inStr, outStr )
To be documented soon...
// inStr is a string (input) // outStr is a CkString object (output) EntityEncodeHex( inStr, outStr )
To be documented soon...
// htmlData is a CkByteData object (input) // strCharset is a CkString object (output) // Returns a boolean value GetHtmlCharset( htmlData, strCharset )
Examines HTML text and extracts the charset name specified by the META tag, if present. Returns true for success, false for failure.
// htmlFilename is a string (input) // strCharset is a CkString object (output) // Returns a boolean value GetHtmlFileCharset( htmlFilename, strCharset )
Examines an HTML file and extracts the charset name specified by the META tag, if present. Returns true for success, false for failure.
// str is a string (input) // strOut is a CkString object (output) // Returns a boolean value HtmlDecodeToStr( str, strOut )
Converts HTML entities to Unicode characters. Returns true for success, false for failure.
// inData is a CkByteData object (output) // outData is a CkByteData object (output) // Returns a boolean value HtmlEntityDecode( inData, outData )
Decodes HTML entities. See http://www.w3.org/TR/REC-html40/sgml/entities.html for information on HTML entities. Examples of HTML entities are < , å , å , 水 , Í , etc.
// inFilename is a string (input) // outFilename is a string (input) // Returns a boolean value HtmlEntityDecodeFile( inFilename, outFilename )
Decodes HTML entities in a file and creates a new HTML file with the entities decoded. See http://www.w3.org/TR/REC-html40/sgml/entities.html for information on HTML entities. Examples of HTML entities are < , å , å , 水 , Í , etc. Returns true for success, false for failure.
// Returns a boolean value IsUnlocked( )
Returns true if the component is unlocked.
// inStr is a string (input) // outStr is a CkString object (output) LowerCase( inStr, outStr )
To be documented soon...
// filename is a string (input) // dataBuf is a CkByteData object (output) // Returns a boolean value ReadFile( filename, dataBuf )
Convenience method for reading the entire contents of a file into a byte array.
// filename is a string (input) // Returns a boolean value SaveLastError( filename )
Saves the last error information to an XML formatted file.
// str is a string (input) SetErrorString( str )
If the ErrorAction property is set to 1, the string passed to this method is used as the result for any characters that cannot be converted during a conversion.
// unlockCode is a string (input) // Returns a boolean value UnlockComponent( unlockCode )
Unlocks the component. This method must be called once at the beginning of the program. Properties can be get/set without unlocking, but methods will not work unless the component has been unlocked.
// inStr is a string (input) // outStr is a CkString object (output) UpperCase( inStr, outStr )
To be documented soon...
// charset is a string (input) // charData is a CkByteData object (input) // Returns a boolean value VerifyData( charset, charData )
Returns true if the byte data conforms to the charset passed in the first argument.
// charset is a string (input) // filename is a string (input) // Returns a boolean value VerifyFile( charset, filename )
Returns true if the file contains character data that conforms to the charset passed in the 1st argument.
// filename is a string (input) // dataBuf is a CkByteData object (input) // Returns a boolean value WriteFile( filename, dataBuf )
Convenience method for saving an entire byte array to a file.
// Returns a string altToCharset( )
If the ErrorAction property is set to 6, then this property controls how errors are handled. It specifies an alternate "To" charset. When a character in the input data cannot be converted to the target charset, an attempt is made to convert it to the AltToCharset. If that fails, the input character is dropped.
// codePage is an integer (input) // Returns a string codePageToCharset( codePage )
Converts a code page number to a charset name. For example, 65001 converts to "utf-8".
// inStr is a string (input) // Returns a string entityEncodeDec( inStr )
To be documented soon...
// inStr is a string (input) // Returns a string entityEncodeHex( inStr )
To be documented soon...
// Returns a string fromCharset( )
Tells the charset converter the charset of the input data for a conversion. Possible values are:
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
// htmlData is a CkByteData object (input) // Returns a string getHtmlCharset( htmlData )
Examines HTML text and extracts the charset name specified by the META tag, if present.
// htmlFilename is a string (input) // Returns a string getHtmlFileCharset( htmlFilename )
Examines an HTML file and extracts the charset name specified by the META tag, if present.
// str is a string (input) // Returns a string htmlDecodeToStr( str )
Converts HTML entities to Unicode characters.
// Returns a string lastErrorHtml( )
Error information in HTML format for the last method called.
// Returns a string lastErrorText( )
Error information in plain-text format for the last method called.
// Returns a string lastErrorXml( )
Error information in XML format for the last method called.
// Returns a string lastInputAsHex( )
If SaveLast is set to true, then the input and output of a conversion is saved to allow the exact bytes that are sent to the converter to be seen (for debugging purposes). This property shows the last input data in a hexidecimalized string.
// Returns a string lastInputAsQP( )
If SaveLast is set to true, then the input and output of a conversion is saved to allow the exact bytes that are sent to the converter to be seen (for debugging purposes). This property shows the last input data in a quoted-printable string.
// Returns a string lastOutputAsHex( )
If SaveLast is set to true, then the input and output of a conversion is saved to allow the exact bytes that are sent to the converter to be seen (for debugging purposes). This property shows the last output data in a hexidecimalized string.
// Returns a string lastOutputAsQP( )
If SaveLast is set to true, then the input and output of a conversion is saved to allow the exact bytes that are sent to the converter to be seen (for debugging purposes). This property shows the last output data in a quoted-printable string.
// inStr is a string (input) // Returns a string lowerCase( inStr )
To be documented soon...
// Returns a string toCharset( )
Tells the charset converter the target charset for a conversion. Possible values are:
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
// inStr is a string (input) // Returns a string upperCase( inStr )
To be documented soon...
// Returns a string version( )
Returns the version of the component, such as "9.0.0"
|