JAVA Chinese in Symbian OS

Hi, all...
I'm currently writing a small program for Symbian OS (mobile OS) which used Unicode as the default system encoding.
The Symbian OS only supported JDK 1.1.8... nothing much I can use.... hmm...
I have a few questions that is confused me.
I'm using following code to read an big5 encode text file:
BufferedReader in = new BufferedReader(
      new InputStreamReader(
      new FileInputStream(modeName(iMODE,true)),"MS950"));and the format of the file is:
<index> <word1> <word2> <word3> ....<wordn>
aaaaa cWORD1 cWORD2 cWORD3 ....
aaaab cWORD4 cWORD5 cWORD6 ....
aaaac cWORD7 cWORD8 cWORD9 ....
etc... cWORD? are big5 encoded characters
I'm wandering, if I use the code above to process the text, then I try to setText("cWORD1") to the TextArea, will JAVA convert to the Unicode automatically?
Do I need to convert the read-in file into Unicode first?
In short, do I have to do anything with the text file (such as change encoding)? or do any convertion during the processing? or just leave it, JAVA will handle the encoding?
Any help/idea/hint?
thanks,
Rick,

It is more accurate to talk about JVM rather than System.
There are at least two types of outputs.
1) Output through the java.io package.
In this case you can use your encoding (e.g., UTF8 or other) when writing or printing in a file, for example.
E.g.
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("output.txt"),"UTF8"));2) In the case of your using the package java.awt and the method <java.awt.Graphics>.drawString(String, int, int), you do not have to worry about the encoding. For example the next will show a sequence of meaningful chinese characters (though the sentence was taken arbitrarily from a book at hand).
//import java.awt.*;
class TestPanel extends Panel {
  public void paint(Graphics g){
    g.drawString("\u9020\u5206\u5929\u5730\u5316\u6210\u842c\u7269", 40, 40);// here you do not refer to the encoding
}// add an instance of this class to a suitable java.awt.Frame instance

Similar Messages

  • Java.io.ioexception :Symbian OS error=-5105

    Hello friends...
    I encountered above error when i run my application on mobile device. I develop program that connect to remote server. When i run program it takes lots of time to connect and then Symbian OS Error -5105(about route not available) is occured. Any one can tell me,what should i do to solve this probelm.
    Thanks in advance.

    There is no need to double post!
    http://forum.java.sun.com/thread.jspa?threadID=704340&messageID=4083594#4083594
    te means (and you'd know if it you would have searched with google):
    -5105      IPv6: No route available
    So apparently you are using IPv6 and it can't find a route to the host you are connecting to.

  • Java for Palm, Symbian, Pocket PC

    I am kind of new to J2ME and just started playing around with it. I made a small midp app and it ran fine on the phone simulator. I have been searching for the past 2 days without any luck on creating an app that would work cross platform. The information I am finding is that for palm and Symbian they suggest C or C++ and would require writing an app twice. Then for the Pocket PC they suggest the compact framework. I guess I thought J2ME was supposed to be able to run on all of these with little code change. Am I wrong on this aspect? I am currently using Netbeans, would a different Java IDE make it so that I can create an app for all of these?

    Normaly such devices only know MIDlets. This is becaus they do not have the power of a PC. In addition to that they are to different in hardware so an other API is to use.
    I think it is notpossible to write a VM to do the same as a PC now.
    Hope this will help you.

  • Error in using jsr-82 in symbian java

    Dear all,
    I am recently writing java application which require using bluetooth api
    (JSR-82). During the compilation, the program works fine. Unfortunately,
    when I try to run it with the emulator, error does come up. I have tried
    different classpath setting already. But the problem still can't be solved.
    Following is the details:
    epocdrive_j=C:\Symbian\UIQ_21\epoc32\Java\
    epocdrive_t=C:\Symbian\UIQ_21\erj
    classpath =
    C:\Symbian\UIQ_21\epoc32\java\lib\classes.zip;C:\Symbian\UIQ_21\epoc32\java\
    lib\emptyapi.zip;C:\Symbian\UIQ_21\erj\classes;C:\Symbian\UIQ_21\erj\ext\qaw
    t.jar;C:\Symbian\UIQ_21\erj\ext\util.jar;C:\Symbian\UIQ_21\erj\ext\btapi.jar
    ;C:\Symbian\UIQ_21\epoc32\java\ext\javaphone.jar;
    command used for compile : "javac -target 1.1 *.java"
    command used for running emulator: "pjava_g -cp t:\PrintClient PrintClient"
    error : "Exception in thread "main" java.lang.NoClassDefFoundError:
    javax/bluetooth/DiscoveryListener"
    This program I am doing is the PrintClient example in JSR82-spec_1.0a.pdf
    can anyone spot any error in my work??
    thank you very much!

    I could be totally wrong here, but i believe the error given means that "DiscoveryListener.class" can not be found in the classpath given, including as part of the jar files listed in the class path.
    Can you check for that filename on your system and tell us where it is if found?

  • How can you get a java program working on a cell phone?

    I was thinking of making some stuff for cell phones so i was wondering how you get a normal java program to work on cells.

    its all j2me - midlet package....Huh? The jsr-118 MID profile alone has 11 packages, one of which is javax.microedition.midlet. Notj2me - midlet.
    works best on nokia phones.Sez who? You seem to be confusing Java ME with Symbian C.
    you can use net beans midlet packge add-on.Only it's called the NetBeans Mobiliity Pack.
    Its easy to use and has lots of tutorials.Ditto for the Wireless toolkit for CLDC.
    just search on google.Yes, but with which keywords?
    @OP:
    NetBeans mobility pack comes with a short tutorial and several samples, you also need to download the latest WTK as the ver. 2.2 which comes bundled with NetBeans is just too buggy to work with. Then there are the manufacturer-specific SDKs from Nokia, Motorola, Sony Ericsson and (maybe) others.
    If and when you get started in Java ME aka j2me, it will be appropriate to post any questions you might have on the mobility forums, not here.
    Google "j2me tutorial" for many good hits.
    luck, db

  • Please instruct how to display Chinese in URL-based portlet

    Hi, I have installed Chinese support opca for my oracle portal and I tried to display Java Chinese portlet successfully.
    I've been testing the url-service now, and I can see the url sample portlets successfully too. However, when I try to display a website including chinese character (e.g.www.yahoo.com.tw, all characters are shown improperly. What else should I do or install?
    P.S. I am using PDK January version.
    Thanks for your help and replies!

    Hi,
    I got it by modifying the provider.xml file with the tag of:
    <charSet>BIG5</charSet>
    for the portlet displaying the website with Chinese Character. For detail, you may refer the the article 'PDK-JAVA XML Provider Definition Tag Reference v2 [HTML format] under the pdk\article directory.
    Thanks for your attention!

  • Midlet on Symbian UIQ

    I tried a midlet with emulator and it run correctly (SonyEricsson P910 and Nokia 6600) but when i tried it on the phone the midlet return the exception " java.io.IOException: Symbian OS error= -33: errore sistema" . Why? i have to do something on the phone? It give the error when the midlet try to connect to an URL. It send data in output (to url) but it doesn�t receive response. Can someone help me?
    Thanks
    Paolo

    Better to use IBM's J9 VM instead of CrEme and check the results.
    ~Mohan

  • Running java apps

    how to get full keybord for input in java applications in symbian 3 devices like c7 thanks....

    With the C7 you should be able to use Swype !
    http://store.ovi.com/content/58438
    If I have helped at all, a click on the White Star is always appreciated :
    you can also help others by marking 'accept as solution' 

  • Lots of error and problems in my N8

    I got this N8 few days ago and encountered a lot of problems which frustrates me a lot. I've been using Symbian S60 for 2 years and satisfy with it until I tried Symbian^3, my interests towards Symbian starting to lost. I hope that my problems can be solved so that I can restore my faith towards Symbian.
    My N8's firmware version was Symbian Anna, software version 022.014. Nokia Suite's version was 3.7.22.
    So these were the problems :
    #1. Every time when I attemps to upgrade the firmware to Belle through Nokia Suite, it fails. I stuck at the USB disconnect and reconnect procedure. As Nokia Suite fails to do that, I also tried the wireless update through the device updates in the settings. There's no result after searching, which confused me.
    #2 In the OVI Store, hot popular apps like Whatsapp, Viber, Opera Mobile 12 can't be installed. It fails every time no matter I connect through Nokia Suite with USB or Bluetooth as well. The error note in the OVI Store was 'Unable to Install. Please download the file again'. I tried for 5 times for a apps and finally gave up.  Installing apps with .sisx or .jav and other symbian supported files did not able to install either. Phone will just told me "Unable to install". Apps like Facebook and eBuddy can be installed can use flawlessly.
    The biggest confusion of mine was install an apps through Nokia Suite, I received an error message of "Time was not right and memory is full' error.
    #3 After encountered all these problem, I've decided to perform a factory reset but the default lock code was not '12345'. Do anyone knows other potential code?
    #4 Every time I connected to Nokia Sync, there will be a notification says that my phone was installing some 'Support Software' and prompts me to accept all the permissions which does not shows up and fails the installation everytime.
    Regards,
    Theam.

    I suspect that previous owner of this device may well have carried out a three key depressed power on "hard reset" to delete existing user data from it, which can also remove certain key certificates from device. I am surprised that you have found an N8 runing upon Symbian Anna and not Belle or Belle Refresh and hope that this device has not been downgraded back to Anna at some point along the way.
    As adrianhughes points out a visit to Nokia Care facility is now needed to re-furbish this device http://nokia.com/support which may reveal some of it's past life.
    Happy to have helped forum in a small way with a Support Ratio = 37.0

  • Error creating jar

    Hi everyone! I'm developing a mobile application for an nokia n95. However a got to an error that I'm finding difficult to deal with.
    This is the code i'm testing:
    import javax.microedition.location.*;
    import javax.microedition.lcdui.*;
    public class touristguide extends Canvas {
         public Criteria cr;
         public double lon;
         public double lat;
         public void Locator(){
              Criteria cr= new Criteria();
              cr.setHorizontalAccuracy(500);
              //Get an instance of the provider
              LocationProvider lp=null;
                   try {
                        lp = LocationProvider.getInstance(cr);
                   } catch (LocationException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                   Location l=null;
                   try {
                        l = lp.getLocation(120);
                   } catch (LocationException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                   } catch (InterruptedException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
              QualifiedCoordinates qc = l.getQualifiedCoordinates();
              if(qc != null ) {
                   // Use coordinate information
                   lat = qc.getLatitude();
                   lon = qc.getLongitude();
                   System.out.println ("latitude: " + lat);
         protected void paint(Graphics g){
              g.drawString("longitude = " + lon,0,0,Graphics.LEFT | Graphics.TOP);
              g.drawString("latitude = " +lat, 0, 20, Graphics.LEFT | Graphics.TOP);
    When i try to run this code there's a window showing the following errors:
    Jar file could not be initialized.
    Caught exception:
    java.util.zip.ZipException: invalid entry compressed size (expected 478 but got 481 bytes)
    at java.util.zip.ZipOutputStream.closeEntry(Unknown Source)
    at java.util.zip.ZipOutputStream.finish(Unknown Source)
    at java.util.zip.DeflaterOutputStream.close(Unknown Source)
    at java.util.zip.ZipOutputStream.close(Unknown Source)
    at com.symbian.io.JARFile.jarClassPath(JARFile.java:225)
    at com.symbian.io.JARFile.<init>(JARFile.java:111)
    at com.symbian.tools.j2me.sei.emulator.EmulatorLauncher.initializeJar(EmulatorLauncher.java:479)
    com.symbian.tools.j2me.sei.emulator.EmulatorLauncher.launch(EmulatorLauncher.java:285)
    com.symbian.tools.j2me.sei.emulator.Main.main(Main.java:49)
    Has anyone faced this kind of errors? What should I do?
    thanks in advance
    NN

    I have the same problem!!!! When I deploy a EAR. So, I try file by file (.jar and .war). The jar file is ok but i get this message when I deploy my .war file
    ---- Deployment started. ---- 5/04/2011 03:48:01 PM
    Target platform is Standard J2EE.
    java.lang.NullPointerException
         at oracle.ide.net.AlikeStrings.packStringArray(AlikeStrings.java:192)
         at oracle.ide.net.AlikeStrings.<init>(AlikeStrings.java:445)
         at oracle.ide.net.JarIndex.buildIndex(JarIndex.java:574)
         at oracle.ide.net.JarUtil.getJarIndex(JarUtil.java:270)
         at oracle.jdevimpl.deploy.JarUtil.needToWriteJarFile(JarUtil.java:802)
         at oracle.jdevimpl.deploy.JarUtil.writeJarFile(JarUtil.java:642)
         at oracle.jdevimpl.deploy.war.WarDeployer.writeWarFile(WarDeployer.java:210)
         at oracle.jdevimpl.deploy.war.WarDeployer.deploy(WarDeployer.java:67)
         at oracle.jdevimpl.deploy.ModulePackager.deploy(ModulePackager.java:139)
         at oracle.jdevimpl.deploy.DynamicDeployer.deploy(DynamicDeployer.java:84)
         at oracle.jdevimpl.deploy.DynamicDeployer.deploy(DynamicDeployer.java:84)
         at oracle.jdevimpl.deploy.J2eeProfileDt$CleanupTransientProfilesDeployer.deploy(J2eeProfileDt.java:71)
         at oracle.jdevimpl.deploy.FinalDeployer.deploy(FinalDeployer.java:48)
         at oracle.jdevimpl.deploy.AsyncDeployer$1.runImpl(AsyncDeployer.java:67)
         at oracle.jdevimpl.deploy.AsyncDeployer$1.run(AsyncDeployer.java:53)
    Elapsed time for deployment: 13 seconds
    #### Deployment incomplete. #### 5/04/2011 03:48:14 PM

  • I have a project in j2ME.i had problem selecting the profile i need in win platform

    ..one more.how would i use javaphone api in java rather than symbian OS

    This forum is mainly for iPlanet products and services.
    For Java support, I suggest you use the Online Support
    area of Java Developer Connection. You can find it at
    http://developer.java.sun.com/developer/support/.

  • Beginner in J2me-Need some tips

    I am in a project that requires developing a java application on symbian OS based mobiles.
    Can someone tell me which software wud be the best to develop upon?Also it should be for free download
    1. Metrowerks CodeWarrior Wireless Studio 7
    2. jVise from S5 Systems
    3.JBuilder 7 Enterprise with MobileSet 3
    4.Sun J2ME Wireless ToolKit
    I am a novice in developing and i just have knowledge of core java

    So what you are saying is that its impossible in
    java,J2EE,J2Me????J2ee stuff does not run on j2me devices. You are bound to the j2me api stuff.
    Okay c++ is excellent, i am fine with it, then how do
    i go about doing this java project.My project leader
    is a project manager of that company, and hes into
    programming for years, so i don't think he wud give
    an impossible task. Well, saidly, in on this topic he is wrong. Look at the j2me api docs and see for yourself: there is no way you can do this with java on a mobile device.
    So could you find out some info for me.I came to this
    forum for some help as i am tired of serching sites
    .I did not get fruitful results as i have been trying
    for days together.I can imagine that, since what you want to do is fairly uncommon and unusiual.
    I can't give you more info than to look into the C++/symbian world :( Bad thing is that you lose your large device base.

  • Storing chinese in client odb from java application

    Hi all,
    first i like to thank Greg Rekounas for his wonderful support and contribution....
    This is my server setup.
    os-windows 2000 sp4
    db-oracle 9ir2 (unicode with AL32UTF8 charset)
    lite-oracle10g r2 (with latest patchset)
    nls_lang- AMERICAN_AMERICA.AL32UTF8
    storing and retriving chinese in oracle 9i database from isql*plus works.
    lite configuration.
    1. In $OLITE_HOME\mobile_oc4j\j2ee\mobileserver\applications
    \mobileserver\setup\common\webtogo\webtogo.ora file edited the JAVA_OPTION
    to:
    JAVA_OPTION=-Djava.compiler=NONE -Dfile.encoding=UTF8
    2. In $OLITE_HOME\mobile_oc4j\j2ee\mobileserver\applications
    \mobileserver\setup\dmc\common\win32.inf file, added the following:
    a. In the <file> section, added the following:
    <item>
    <src>/common/win32/olilUTF8.dll</src>
    <des>$APP_DIR$\bin\olilUTF8.dll</des>
    </item>
    b. In the <ini> section, added the following:
    <item name='POLITE.INI' section='All Databases'>
    <item name="DB_CHAR_ENCODING">UTF8</item>
    </item>
    <item name='POLITE.INI' section='SYNC'>
    <item name="DB_ENCODING">UTF8</item>
    </item>
    published the application developed in java using packaging wizard.
    downloaded the client in the pc with the following config:
    windows 2000 (english)
    nls - default.
    installed chinese language support.
    tried to access 9i database from isql*plus and stored & viewed chinese characters sucessfully.
    tried to store a chinese character from java application in the client odb -- failed.
    values are getting inserted from the application but when i view them back it shows & # 2 6 0 8 5 ; (i have included a space in between all 8 characters.
    but when i copy this no and paste in msword it shows 日(chinese character)
    i dont know the exact reason for the above scenerio...................
    Also please help me on this too.......
    why can i store & view chinese characters sucessfully in isql*plus from the client machine while i cannot do the same on client odb from java application even though the lite config are done to support utf8?
    is anything i left out?
    should i do any codes changes in java?(java application is of verision jdk1.4_13)
    Thanks,
    Ashok kumar.G

    Sorry for late replay!! in the SharePoint server both the Claim based and Classic mode is enabled in the server, but still I want to get authenticated via Classic mode just like it happens in SharePoint  2007 and 2010, so do i have to use a different
    set of classes to do that if yes can you please tell me those ?

  • How can i send the chinese sms using java J2EE(web application)

    hi,
    i have the difficulty on sending chinese sms using J2EE application.i try to input the chinese word to jsp and send the plain text sms. i received the sms with plenty of question mark "?????". i think it is regarding to the conversion of String to some kind of format that supported by mobile phone. below are some code the send the sms to recipient. i need someone help in order to have the solution.
    thanks a lot
    <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
    <%@ page import="se.sapio.rta.service.MPMService"%>
    <%@ page import="java.util.Locale"%>
    <%
         Locale.setDefault(Locale.UK);
         Context ctx;
         MPMService mpmservice;
         ctx = new InitialContext();
         mpmservice = (MPMService) ctx.lookup("BC/Service/RTAMPM");
         LSUser user = null;
         boolean ok = true;
         try {
         if (ok) {
              String sender = request.getParameter("sender");
              String phonenr = request.getParameter("phonenr");
              String sendmsg = request.getParameter("sendmsg");
              if(bError) {
                   byte[] bytes = message.getBytes("UTF-8");
                   message = mobileclientservice.ByteEncode(bytes);          
                   response.sendRedirect("send_sms.jsp?s="+request.getParameter("s")+"&msg="+message+"&phonenr="+request.getParameter("phonenr").replaceAll("\\+","%2B")+"&sender="+request.getParameter("sender")+"&sendmsg="+request.getParameter("sendmsg").replaceAll("\\+","%2B"));
              String resp = "";
              if(mpmservice.sendPlainTextSMS(sender, phonenr, sendmsg)) {
                   resp=mpmservice.getLang(user.getLang(), "sms_sent");
              } else {
                   resp=mpmservice.getLang(user.getLang(), "sms_not_sent");
              } %>
              <jsp:include page="/top.jsp" />
              <p class="headline"><%=mpmservice.getLang(user.getLang(), "send_sms_title")%></p>
              <form name="operatordetails" id="operatordetails" method="post" action="send_sms.jsp">
              <INPUT TYPE=hidden NAME=s VALUE="<%=request.getParameter("s")%>">
              <INPUT TYPE=hidden NAME=phonenr VALUE="<%=request.getParameter("phonenr")%>">
              <table class="infotable" id="report">
                   <tr>
                        <td class="left" colspan="2"><%=resp%></td>
                        <td class="right"></td>
                   </tr>
                   <tr>
                        <td class="left" colspan="2">
                             <input class="halfmiddle" name="Back" type="submit" id="Back" value="<%=mpmservice.getLang(user.getLang(), "back")%>" />
                        </td>     
                        <td class="right"> </td>
                   </tr>
              </table>
              </form>
              <jsp:include page="/bottom.jsp" />
         <% } %>
       public boolean sendPlainTextSMS(String sender, String recipient, String sendmsg){
             if(recipient.charAt(0) == '+')
                   recipient = recipient.substring(1);
             String senderIdType = "Alpha";
              if( (sender.charAt(0) >= '0' && sender.charAt(0) <= '9') || sender.charAt(0) == '+')
                   senderIdType = "Numeric";
                   if(sender.charAt(0) == '+')
                        sender = sender.substring(1);
                   for(int i=0; i < sender.length(); i++)
                        if(!(sender.charAt(i) >= '0' && sender.charAt(i) <= '9'))
                             senderIdType = "Alpha";
             log.warn("sending sms to: "+recipient + " sendtype: " + senderIdType + " msg: "+ sendmsg);
             log.warn("Encoded sms:"+Encode(sendmsg));
             try{
             String postData = "XMLDATA=" + URLEncoder.encode("<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\r\n" +
                        "<NotificationRequest Version=\"3.4\">\r\n" +
                        "     <NotificationHeader>\r\n" +
                        "          <PartnerName>" + SMS_PARTNER_NAME + "</PartnerName>\r\n" +
                        "          <PartnerPassword>" + SMS_PARTNER_PASSWORD + "</PartnerPassword>\r\n" +
                        "          <SubscriptionName>XML</SubscriptionName>\r\n" +
                        "     </NotificationHeader>\r\n" +
                        "     <NotificationList BatchID=\"1\">\r\n" +
                        "          <Notification SequenceNumber=\"0\" MessageType=\"SMS\">\r\n" +
                        "          <Message>" + Encode(sendmsg) + "</Message>\r\n" +
                        "          <Profile>" + SMS_PARTNER_PROFILE + "</Profile>\r\n" +
                        "          <SenderID Type=\"" + senderIdType + "\">" + sender + "</SenderID>\r\n" +
                        "          <Subscriber>\r\n" +
                        "               <SubscriberNumber>" + recipient + "</SubscriberNumber>\r\n" +
                        "          </Subscriber>\r\n" +
                        "      </Notification>\r\n" +
                        " </NotificationList>\r\n" +
                        "</NotificationRequest>","ISO-8859-1");
      appreciate for anyone provide the solution.
    thanks a lot

    Hi,
    I want to send sms from web application to mobile phones at the time of registration. Its verymuch greatful to me, if you let me know, how to send from jsp to mobile. because from your post, i got, you already know about sending sms from jsp to mobile.
    please let me know, how to send sms
    [email protected]
    Thanks in advance for your kind help

  • How to print Chinese character in java

    Hi All,
    I have a problem .
    I am trying to read a file which contains chinese characters and the print the content of this file to the printer.
    But when the content of the file is being printed, it is printing weird characters and not chinese characters. Can anyone please help.
    Plese find below, my code.
    import java.io.*;
    import java.lang.*;
    import java.io.BufferedInputStream;
    class FileRead{
    //--------------------------------------------------< main >--------//
    public static void main (String[] args) {
    FileRead t = new FileRead();
    t.readMyFile();
    //--------------------------------------------< readMyFile >--------//
    void readMyFile() {
    String record = null;
    int recCount = 0;
    try {
         FileReader fr = new FileReader("amaebisushi.GB.TXT");
         FileOutputStream os = new FileOutputStream("\\\\ps_apex_1\\ps_lpt1");
    BufferedReader br = new BufferedReader(fr);
    PrintStream ps2 = new PrintStream(os);
    record = new String();
    while ((record = br.readLine()) != null) {
    recCount++;
    System.out.println(recCount + ": " + record);
    ps2.println(recCount + ": " + record);
    } catch (IOException e) {
    // catch possible io errors from readLine()
    System.out.println("Uh oh, got an IOException error!");
    e.printStackTrace();
    } // end of readMyFile()
    } // end of class

    Try not to rely upon the default encoding, but define it explicitly.

Maybe you are looking for