Class Index | File Index

Classes


Class CharmapTable


Extends Charmap.
Create a new character set mapping instance using based on a trie table. Charmap instances map strings to other character sets. The charsets can be of any type, single-byte, multi-byte, shifting, etc.

All mappings are done to or from Unicode in the UTF-16 encoding, which is the base character set and encoding used by Javascript itself. In order to convert between two non-Unicode character sets, you must chain two charmap instances together to first map to Unicode and then back to the second charset.

The options parameter controls which mapping is constructed and its behaviours. The current list of supported options are:

If this copy of ilib is pre-assembled and all the data is already available, or if the data was already previously loaded, then this constructor will call the onLoad callback immediately when the initialization is done. If the onLoad option is not given, this class will only attempt to load any missing data synchronously.
Defined in: ilib-full-dyn.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
CharmapTable(options)
Method Summary
Method Attributes Method Name and Description
 
mapToNative(string)
Map a string to the native character set.
 
mapToUnicode(bytes)
Map a native string to the standard Javascript charset of UTF-16.
Methods borrowed from class Charmap:
getName
Class Detail
CharmapTable(options)
Parameters:
{Object=} options
options which govern the construction of this instance
See:
for information about registering a loader callback instance
Method Detail
{Uint8Array} mapToNative(string)
Map a string to the native character set. This string may be given as an intrinsic Javascript string object or an IString object.
Parameters:
{string|IString} string
string to map to a different character set.
Returns:
{Uint8Array} An array of bytes representing the string in the native character set

{string} mapToUnicode(bytes)
Map a native string to the standard Javascript charset of UTF-16. This string may be given as an array of numbers where each number represents a code point in the "from" charset, or as a Uint8Array array of bytes representing the bytes of the string in order.
Parameters:
{Array.<number>|Uint8Array} bytes
bytes to map to a Unicode string
Returns:
{string} A string in the standard Javascript charset UTF-16

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Jun 14 2017 00:48:27 GMT-0700 (PDT)