WMLScript » Lang » Lang.characterSet

Syntax:
Lang.characterSet()

Returns the character set being supported.

The Lang.characterSet function returns an integer value that identifies the character set that is currently supported by the browser.

The returned integer is the unique MIBEnum code that has been assigned by the Internet Assigned Number Authority (IANA) to every character set that "may be used in the Internet and may be referred to in Internet documentation." The assigned values can be viewed at:

ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets

For example, the Nokia WAP Toolkit v2.0 returns an MIBEnum value of 1000. This is the ISO-10646-UCS-2 character set commonly called Unicode.

Clearly the character set being used will be very browser specific.

This function does not take a parameter.

Examples

Code:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.WAPforum.org/DTD/wml_1.1.xml">
<wml>

<card id="card1">
   <p>
   characterSet example
   </p>
   <do type="accept">
      <go href="CharacterSetExample.wmls#findcharacterset()" />
   </do>
</card>

<card id="card2">
<p>
   character set = $(charset)
</p>
</card>

</wml>
Explanation:

Code for CharacterSetExample.wml

Language(s): WML
Code:
extern function findcharacterset()
{
   var result = Lang.characterSet( );
   WMLBrowser.setVar("charset", result);
   WMLBrowser.go("CharacterSet.wml#card2");
};
Explanation:

Code for CharacterSetExample.wmls

Language(s): WML

See Also: