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

Bug#386443: gcj-4.1: UTF-16 endianness differs between gcj and Sun JDK

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

This program gives different results with Sun's JDK (sun-java5-jdk
1.5.0-08-1) and gcj:

======== Test.java ========
import java.io.*;

public class Test
    public static void main(String[] args) throws java.io.IOException
        OutputStreamWriter o = new OutputStreamWriter(System.out, "UTF-16");

According to Sun's API docs
the UTF-16 encoding is supposed to default to big-endian. This is also
what I get when running with Sun's JVM:

00000000: feff 0048 0065 006c 006c 006f 0021       ...H.e.l.l.o.!

But when I run the same program with gij, I get little-endian output:

00000000: fffe 4800 6500 6c00 6c00 6f00 2100       ..H.e.l.l.o.!.

In both cases I executed the same .class file, compiled with the Sun

-- 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-9     The GNU C compiler
ii  gcj-4.1-base                 4.1.1-10    The GNU Compiler Collection (gcj b
ii  gij-4.1                      4.1.1-10    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-9   GCC support library
ii  libgcj7                      4.1.1-10    Java runtime library for use with 
ii  libgcj7-dev                  4.1.1-10    Java development headers and stati
ii  libgcj7-jar                  4.1.1-10    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-11 Jar creation utility

-- no debconf information

Reply to: