Sun Microsystems J2ME manual Emulated Locale, Character Encodings

Models: J2ME

1 134
Download 134 pages 62.02 Kb
Page 128
Image 128

C.2 Emulated Locale

The microedition.locale property is the MIDP system property that defines the current locale of the device, which is null by default. For the J2ME Wireless Toolkit emulator, this value is automatically set to the default locale for the J2SE environment you are running. For example:

If you are running in an English system in the US, the microedition.locale is set to en-US.

If you are running in a French system, the microedition.locale is set to fr-FR.

For information on microedition.locale, consult the MIDP specification.

You can override the default value by adding the microedition.locale property to the file {toolkit}\wtklib\{platform}\ktools.properties file and define the property as desired, as shown in the following examples:

microedition.locale=en-US

microedition.locale=null

For details on setting a default locale, see the J2ME Wireless Toolkit Basic

Customization Guide.

C.3 Character Encodings

The CLDC system property, microedition.encoding, defines the default character encoding name of the MIDP environment. In the J2ME Wireless Toolkit emulator, this property is set according to the underlying window system you are using. The property’s value is set to the default encoding for the J2SE environment running on the same window system. For example, in an English window system, the encoding setting is

microedition.encoding=ISO8859_1

You can override the default value by adding the microedition.encoding property to the {toolkit}\wtklib\{platform}\ktools.properties file. For example, if you want to use UTF-8 as the default setting on Windows, you can set the property in the {toolkit}\wtklib\Windows\ktools.properties file as follows:

microedition.encoding=UTF-8

For more information on character encoding, see the CLDC specification.

116 J2ME Wireless Toolkit User’s Guide • October 2004

Page 128
Image 128
Sun Microsystems J2ME manual Emulated Locale, Character Encodings