Class Index | File Index

Classes


Class Charmap

Create a new default character set mapping instance. This class is the parent class of all of the charmapping subclasses, and only implements basic US-ASCII mapping. The subclasses implement all other charsets, some algorithmically, and some in a table-based way. Use CharmapFactory to create the correct subclass instance for the desired charmap.

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: Charmap.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Charmap(options)
Method Summary
Method Attributes Method Name and Description
 
Return the standard name of this charmap.
 
mapToNative(string)
Map a string to the native character set.
 
mapToUnicode(bytes)
Map a native string to the standard Javascript charset of UTF-16.
Class Detail
Charmap(options)
Parameters:
{Object=} options
options which govern the construction of this instance
Method Detail
{string} getName()
Return the standard name of this charmap. All charmaps map from Unicode to the native charset, so the name returned from this function corresponds to the native charset.
Returns:
{string} the name of the locale's language in English

{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.|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 Thu Nov 15 2018 17:45:08 GMT-0800 (PST)