Certain Arabic characters are not properly displayed in Java ME applications that utilize LCDUI Forms on Symbian devices
Contents |
Overview
Some Arabic characters, are not properly displayed in Java ME applications on Symbian devices.
Description
The following sequences of Arabic characters are not properly displayed and some characters are cut off on Symbian devices:
Arabic Sample Text No1: "ادخل الاسم"
Arabic Sample Text No2: "اسمي"
The error affects LCDUI Forms when the String is appended as an item.
How to reproduce
In the code below, the affected sequences of Arabic characters are displayed twice. Once as appended items to the MIDlet's main form and once as String contained within a non modifiable TextField that is appended to the main form.
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.TextField;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
public class ArabicErrorsMIDlet extends MIDlet implements CommandListener {
Display display;
Form mainform;
Command exitCommand = new Command("Exit", Command.EXIT, 0);
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {}
protected void pauseApp() {}
protected void startApp() throws MIDletStateChangeException {
display = Display.getDisplay(this);
mainform = new Form("Arabic Errors");
mainform.addCommand(exitCommand);
mainform.setCommandListener(this);
mainform.append("INCORRECT\n");
String s = "ادخل الاسم";
mainform.append(s);
mainform.append("\n");
mainform.append("اسمي");
mainform.append("\n\nCORRECT");
String txt = "ادخل الاسم";
String txt2 = "اسمي";
TextField text = new TextField("",txt,20,TextField.UNEDITABLE);
TextField text2 = new TextField("",txt2,20,TextField.UNEDITABLE);
mainform.append(text);
mainform.append(text2);
display.setCurrent(mainform);
}
public void commandAction(Command c, Displayable d) {
if(c == exitCommand)
{
notifyDestroyed();
}
}
}
When the String is appended directly to the form, it is not displayed properly. When the String is wrapped within a TextField, the error cannot be reproduced.
This is a screenshot from Nokia 701:
Affected Devices
This error seems to affect all Symbian devices. It has been reproduced in the following devices:
S60 3rd Edition Feature Pack 1: Nokia E71 and Nokia N95
S60 3rd Edition Feature Pack 2: Nokia E52
S60 5th Edition: Nokia C5-03
Nokia Belle: Nokia 701
This error does not affect Series 40 devices.
Solution
As a solution, it is possible to create a non-modifiable TextField that contains the Arabic String and append that to the Form, instead of appending directly the String, as shown in the sample code here.
Article Metadata
Code Example
Tested with
Compatibility
Article



Pkmatta - Solution
Better solution is to use a stringItem that contains Arabic string. Attach the stringItem to form. Call function setPreferredSize(getPreferredWidth(), getPreferredHeight()) on stringitempkmatta 13:55, 28 May 2012 (EEST)