[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#388596: gcj-4.1: CharsetEncoder.canEncode() gives different results than Sun version



Package: gcj-4.1
Version: 4.1.1-13
Severity: normal

The following test program gives different results with gcj and Sun JDK:

// A.java
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;

public class A {
    public static void main(String[] args) throws java.io.IOException
    {
        CharsetEncoder enc = Charset.forName("US-ASCII").newEncoder();
        System.out.println(enc.canEncode('\u00e4'));
    }
}
// end

$ javac A.java
$ /usr/lib/jvm/java-1.5.0-sun/bin/java A
false
$ /usr/lib/jvm/java-gcj/bin/java A
true

The Sun version seems to return something like (c > 31 && c < 127),
which makes sense, whereas gcj always gives true.

This breaks lots of code, such as Apache JaxMe 2 version 0.51
(specifically the MarshallerTest in the test suite, which generated
invalid XML with gcj).

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-1-686
Locale: LANG=sv_SE.UTF-8, LC_CTYPE=sv_SE.UTF-8 (charmap=UTF-8)

Versions of packages gcj-4.1 depends on:
ii  gcc-4.1                      4.1.1-13    The GNU C compiler
ii  gcj-4.1-base                 4.1.1-13    The GNU Compiler Collection (gcj b
ii  gij-4.1                      4.1.1-13    The GNU Java bytecode interpreter
ii  java-common                  0.25        Base of all Java packages
ii  libc6                        2.3.6.ds1-4 GNU C Library: Shared libraries
ii  libc6-dev                    2.3.6.ds1-4 GNU C Library: Development Librari
ii  libgcc1                      1:4.1.1-13  GCC support library
ii  libgcj7-dev                  4.1.1-13    Java development headers and stati
ii  libgcj7-jar                  4.1.1-13    Java runtime library for use with 
ii  zlib1g                       1:1.2.3-13  compression library - runtime

Versions of packages gcj-4.1 recommends:
ii  fastjar                       1:4.1.1-13 Jar creation utility

-- no debconf information



Reply to: