This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
UTF-16 not supported?
- From: Suresh Raman <sugansha at yahoo dot com>
- To: java at gcc dot gnu dot org
- Date: Thu, 15 Aug 2002 15:02:01 -0700 (PDT)
- Subject: UTF-16 not supported?
Hi,
I have a piece of code here that attempts to use UTF-16BE encoding.
---sample--
public class encodingtest
{
public static void main(String args[]) throws Exception
{
String encoding = "UTF-16BE";
String str = "hello world";
byte[] strbytes = str.getBytes(encoding);
String newstr = new String(strbytes, encoding);
System.out.println(newstr);
}
}
--end sample---
The output of the program should be "hello world", which it is with
UTF-8. But with UTF-16 or UTF-16BE, the output is a truncated string
"hell" or "hello".
I am using the the 3.1 release of gcc on my Mandrake 8.1 linux box.
I tried to wade through the relevant source code, and I think I am on
to something, but before I embarrass myself, I thought I'd post it here
and get some input.
thanks,
--Suresh
__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com