Java – J2ME Midlet exception :IOException reading reader invalid first byte

javajava-memidletmidp

When i run my midlet with Java Wireless toolkit, midlet runs correctly, but when it try to parse a textfield, following error occurs;

java.lang.RuntimeException: IOException reading reader invalid first byte 10010111
    at com.sun.cldc.i18n.Helper.byteToCharArray(+228)
    at com.sun.cldc.i18n.Helper.byteToCharArray(+9)
    at java.lang.String.<init>(+7)
    at z.a(+219)
    at z.a(+103)
    at DP4JPhone.a(+74)
    at DP4JPhone.a(+115)
    at DP4JPhone.commandAction(+120)
    at javax.microedition.lcdui.Display$DisplayAccessor.commandAction(+282)
    at javax.microedition.lcdui.Display$DisplayManagerImpl.commandAction(+10)
    at com.sun.midp.lcdui.DefaultEventHandler.commandEvent(+68)
    at com.sun.midp.lcdui.AutomatedEventHandler.commandEvent(+47)
    at com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.handleVmEvent(+186)
    at com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.run(+57)

What is the problem?

I am using JWT 2.5.2_01

Best Answer

Problem Solved.

As McDowell mentioned before, problem was about encoding settings. Best way to overcome this problem is declaring encoding info from WTK.

Within your working directory, find ktools.properties file ('workdir\wtklib\ktools.properties' or 'workdir\wtklib\Linux\ktools.properties' as is on my machine). And add the following lines:

microedition.encoding= *encoding*

For ASCII encoding:

microedition.encoding=ISO8859_1

That will do the job (:

Related Topic