Emoji is a Japanese term representing a pictograph. It is used like an emoticon in messaging to express an idea. A large number of emoji characters are encoded in Unicode for use on mobile devices.

Emoji in Nokia Asha software platform

Nokia Asha software platform 1.1 uses standard Unicode emoji characters in the range U+1F300 to 1F64F. These Unicode values are supported in TextBox, TextField and TextEditor UI components.

The emoji characters are handled using UTF16 surrogate pairs, which maps an emoji character to a pictograph, provided by Nokia, and displays on the mobile device. The same UTF16 values are returned when reading a character back from the Java text component.


Special encoding can be used in Strings used in TextField, TextEditor, TextBox and in Graphics.drawString() to show Emojis on the Nokia Asha software platform.

The code of the Emoji has to be encoded into surrogate pairs before adding it to the String to be set. Codes longer than 4 digits should be separated by space like the following:

  • XX XXXX or


The following code can be used to convert the code to a format, which can be passed to converted to surrogate pairs:

public static String checkCodeFormat(String code) {
	if (code == null) {
		return code;
	if (code.length() == 10) {
		String c1 = code.substring(0, 5);
		String c2 = code.substring(5);
		return c1 + " " + c2;
	} else if (code.length() == 6) {
		String c1 = code.substring(0, 2);
		String c2 = code.substring(2);
		return c1 + " " + c2;
	} else {
		return code;

And the following code can be used to get the surrogate pair of the Emoji, which can be added to the String to be used by the TextField, TextBox, TextEditor or Graphics.drawString():

public static String getSurrogatePairs(String inputString) {
	int character;
	char low, high;
	int start = 0, end = 0;
	if (inputString == null) {
		return inputString;

	StringBuffer sb = new StringBuffer(1000);

	// Go through all characters in the input.
	// Space (0x20) is used as separator
	do {
		end = inputString.indexOf(" ", start);

		// Space not found -> last sub-string
		if (end == -1) {
			end = inputString.length();

		try {
			character = Integer.parseInt(inputString.substring(start, end), 16);
		} catch (Exception e) {
			return null;

		// Anything below 0xffff is not surrogate pair
		if (character < 0xffff) {
			sb.append((char) character);
		} else {
			// From http://www.unicode.org/faq/utf_bom.html
			high = (char) (LEAD_OFFSET + (character >> 10));
			low = (char) (0xDC00 + (character & 0x3FF));


		// skip the space
		start = (end + 1);
	} while (end != inputString.length());

	return sb.toString();

Following is an example of how it can be used:

TextEditor te = ...
String code = getSurrogatePairs(checkCodeFormat("1f1ef1f1f5"));

Supported codes

The following figure lists all the Emoji codes supported by the Nokia Asha software platform, which can be used by MIDlets:

Figure 1. Emoji codes supported by the Nokia Asha software platform

Last updated 14 March 2014

Back to top