From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7475 invoked by alias); 17 Apr 2005 12:41:51 -0000 Mailing-List: contact java-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-prs-owner@gcc.gnu.org Received: (qmail 6499 invoked by uid 48); 17 Apr 2005 12:41:11 -0000 Date: Sun, 17 Apr 2005 12:41:00 -0000 From: "gruni dot ca at gmail dot com" To: java-prs@gcc.gnu.org Message-ID: <20050417124104.21068.gruni.ca@gmail.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug java/21068] New: String(strBytes, "UTF-16LE"); thorws java.io.UnsupportedEncodingException X-Bugzilla-Reason: CC X-SW-Source: 2005-q2/txt/msg00160.txt.bz2 List-Id: The constructor String(strBytes, "UTF-16LE"); throws a UnsupportedEncodingException which is not logical, becasue the Charset is supported according to Charset.availableCharsets() TestCase will follow. This is my output Available Charsets are: {ISO-8859-1=ISO-8859-1, US-ASCII=US-ASCII, UTF-16=UTF-16, UTF-16BE=UTF-16BE, UTF-16LE=UTF-16LE, UTF-8=UTF-8} Exception in thread "main" java.io.UnsupportedEncodingException: UTF-16LE (java.lang.ClassNotFoundException: gnu.gcj.con vert.Input_UnicodeLittle not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:.\], parent=gnu.gcj.runtime.VMClassLo ader{urls=[core:/], parent=null}}) at GcjStringTest.main(java.lang.String[]) (E:\2004-development\2005-extraextra\src\GcjStringTest.java) at ._main (C:\DOKUME~1\GRUNEW~1\LOKALE~1\Temp\ccM5baaa.i) And accoring to the APIdocs: String public String(byte[] bytes, String charsetName) throws UnsupportedEncodingException Constructs a new String by decoding the specified array of bytes using the specified charset. The length of the new String is a function of the charset, and hence may not be equal to the length of the byte array. The behavior of this constructor when the given bytes are not valid in the given charset is unspecified. The CharsetDecoder class should be used when more control over the decoding process is required. Parameters: bytes - the bytes to be decoded into characters charsetName - the name of a supported charset Throws: UnsupportedEncodingException - If the named charset is not supported Since: JDK1.1 The charset should be taken out of the Charsets class. So ya this is a bug in my eyes. Regards, Andreas -- Summary: String(strBytes, "UTF-16LE"); thorws java.io.UnsupportedEncodingException Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: critical Priority: P2 Component: java AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: gruni dot ca at gmail dot com CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21068