From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26118 invoked by alias); 5 Mar 2003 16:11:35 -0000 Mailing-List: contact mauve-discuss-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: mauve-discuss-owner@sources.redhat.com Received: (qmail 26093 invoked from network); 5 Mar 2003 16:11:34 -0000 Received: from unknown (HELO merc61.na.sas.com) (149.173.6.14) by 172.16.49.205 with SMTP; 5 Mar 2003 16:11:34 -0000 Received: from merc18.na.sas.com ([10.16.12.224]) by 10.19.11.2 with InterScan Messaging Security Suite; Wed, 05 Mar 2003 11:11:33 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.0.6410.0 Content-Class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Question about getEncoding method on different platforms Date: Wed, 05 Mar 2003 16:11:00 -0000 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: From: "Patrick Ellis" To: X-SW-Source: 2003-q1/txt/msg00032.txt.bz2 I have testcases that are failing across several platforms because the enco= ding value that is returned from the different platforms does not match the 8859_1 value that is being expected by the testcase. Example the value of A= SCII is returned for Sun and Linux.=20 Question: Should the mauve code be changed to reflect the correct values ex= pected for each platform ? Code: gnu/testlet/java/io/InputStreamReader/jdk11.java // Tags: JDK1.1 package gnu.testlet.java.io.InputStreamReader; import gnu.testlet.Testlet; import gnu.testlet.TestHarness; import java.io.*; public class jdk11 implements Testlet { public void test (TestHarness harness) { try { InputStreamReader isr =3D new InputStreamReader (new String= BufferInputStream ("zardoz has spoken")); harness.check(!isr.ready(), "ready()"); // deprecated pos= t-1.1 harness.check(isr.getEncoding(), "8859_1", "getEncoding"); char[] cbuf =3D new char[10]; isr.read (cbuf, 0, cbuf.length); String tst =3D new String(cbuf); harness.check(tst, "zardoz has", "read(buf[], off, len)"); harness.check(isr.read(), ' ', "read()"); isr.close (); harness.check(true, "close()"); } catch (IOException e) { harness.check(false, "IOException unexpected"); } } } gnu/testlet/java/io/OutputStreamWriter/jdk11.java // Tags: JDK1.1 package gnu.testlet.java.io.OutputStreamWriter; import gnu.testlet.Testlet; import gnu.testlet.TestHarness; import java.io.OutputStreamWriter; import java.io.ByteArrayOutputStream; import java.io.IOException; public class jdk11 implements Testlet { public void test (TestHarness harness) { try { String tstr =3D "ABCDEFGH"; ByteArrayOutputStream baos =3D new ByteArrayOutputStream(); OutputStreamWriter osw =3D new OutputStreamWriter (baos); = //Default encoding harness.check(true, "OutputStreamWriter(writer)"); harness.check(osw.getEncoding(), "8859_1", "getEncoding"); osw.write(tstr.charAt(0)); = // 'A' harness.check(true,"write(int)"); osw.write("ABCDE", 1, 3); = // 'ABCD' harness.check(true,"write(string, off, len)"); char[] cbuf =3D new char[8]; tstr.getChars(4, 8, cbuf, 0); osw.write(cbuf, 0, 4); = // 'ABCDEFGH' harness.check(true,"write(char[], off, len)"); osw.flush(); harness.check(true, "flush()"); harness.check(baos.toString(), tstr, "Wrote all characters = okay"); osw.close (); harness.check(true, "close()"); ByteArrayOutputStream baos2 =3D new ByteArrayOutputStream(); OutputStreamWriter osw2 =3D new OutputStreamWriter(baos2, "= 8859_3"); harness.check(osw2.getEncoding(), "8859_3", "OutputStreamWr= iter(writer, encoding)"); } catch (IOException e) { harness.check(false, "IOException unexpected"); } } } >From JavaTM 2 Platform Std. Ed. v1.4.1 getEncoding public String <../../java/lang/String.html> getEncoding() Return the name of the character encoding being used by this stream.=20 If the encoding has an historical name then that name is returned; otherwi= se the encoding's canonical name is returned.=20 If this instance was created with the OutputStreamWriter(OutputStream, Str= ing) <../../java/io/OutputStreamWriter.html> constructor then the returned= name, being unique for the encoding, may differ from the name passed to th= e constructor. This method may return null if the stream has been closed.=20 Returns:=20 The historical name of this encoding, or possibly null if the stream has b= een closed=20 See Also:=20 Charset <../../java/nio/charset/Charset.html>=20 Pat Ellis SDE Build and Test Team Phone: (919) 531-0355=20=20=20 R2263 Patrick.Ellis@sas.com SAS... The Power to Know