Twim with Unicode support

I added UTF-8 encoding support to the Twim application. In case you didn’t know, Twim is Twitter client software that runs on all phones that support J2ME. With the latest version you should be able to see correct characters in tweets if your phone has required fonts available. Here’s for example my test tweet containing simplified Chinese characters:

This was rather easy to implement since we can define encoding when constructing stream reader from input stream:

  1. public void doStuff(InputStream stream) {
  2.   try {
  3.  
  4.     // Try to initialize reader with UTF-8 encoding
  5.     reader = new InputStreamReader(stream, "UTF-8");
  6.  
  7.  
  8.     // Device doesn’t support UTF-8, use default
  9.     reader = new InputStreamReader(stream);
  10.  
  11.   }
  12.   // …read data and do stuff…
  13. }

This version also has a new feature for refresing the feed without the need for restart. You can download the application from Phoload page or from here.

This entry was posted in MIDlet, Software, Tips and Tricks and tagged , , , . Bookmark the permalink.

One Response to Twim with Unicode support

  1. un says:

    hello:

    Rssreader…..

    private ResourceProviderME() {
    //#ifdef DTEST
    //@ long beginMe = System.currentTimeMillis();
    //@ System.gc();
    //@ long beginMem = Runtime.getRuntime().freeMemory();
    //#endif
    final Hashtable tmpMsgs = new Hashtable();
    InputStream is = null;
    try {
    is = getClass().getResourceAsStream(
    “/”+Common.DATA_FOLDER+”/” + Common.LANGUAGE_FILE);
    if (is == null) {
    throw new IOException(“Unable to read file ” +
    “/”+Common.DATA_FOLDER+”/” + Common.LANGUAGE_FILE);
    }

    where is location “/”+Common.DATA_FOLDER+”/” + Common.LANGUAGE_FILE);

    I cann’t find it.thank you very much

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>