This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libgcj/21068] String(strBytes, "UTF-16LE"); thorws java.io.UnsupportedEncodingException


------- Additional Comments From ovidr at users dot sourceforge dot net  2005-04-17 15:21 -------
The work-around which forces inclusion of the needed class:

import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;

public class GcjStringTest {

  static {
    gnu.gcj.convert.Input_UnicodeLittle i_UL = new 
gnu.gcj.convert.Input_UnicodeLittle();
  }

  public static void main(String args[]) throws UnsupportedEncodingException{
    System.out.println("Available Charsets are:\n"
        +Charset.availableCharsets().toString());
    byte[] strBytes = {0x12,0x0A,0x14,0xF};
    //Creating String with UTF which is available according to Charsets
    String mine = new String(strBytes, "UTF-16LE");
    //shouldn't recieve Exception
    System.out.println("["+mine+"]");
  }
}

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21068


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]