[kaffe] jar fails to open file with UTF-8 name

Marko Kreen marko at l-t.ee
Tue Jan 18 01:13:24 PST 2005

On Sun, Jan 16, 2005 at 05:32:35PM +0200, Kalle Olavi Niemitalo wrote:
> The jar program installed with Kaffe fails to open a file whose
> name contains non-ASCII characters encoded in UTF-8.  This occurs
> in both fi_FI.UTF-8 and C locales.  Please see the attached ZIP
> for details.  All the files generated by running test.sh are
> included, so you can compare them with what you get.
> The bug occurred on an i386 compatible system running Debian
> GNU/Linux with packages mostly from the unstable distribution,
> including kaffe 1.1.4.PRECVS6-1 and libc6 2.3.2.ds1-16.

I strace'd the jar process, seems like it tries to open the file
using UTF16 encoding, instead of UTF8.

Also I made a simpler testcase:
import java.io.*;
public class UTF8Open {
    public static void main(String [] args) {
        String fn = "Tekstikäyttöliittymä.class";
        try {
            FileInputStream in = new FileInputStream(fn);
        } catch (Exception ex) { ex.printStackTrace(); }

Filename encoding should be get from LANG/LC_* environment
variables.  Seems like kaffe/classpath ignore those ATM.

Looking more into it, problematic spot is in Classpath's
Java_gnu_java_nio_channels_FileChannelImpl_open(), which uses
JCL_jstring_to_cstring for filename conversion.  There should
be something locale-aware.

All this is only for open(), there is also directory read
which I havent looked and zipfile i/o, which seems to force
UTF-8 so it may be ok.


More information about the kaffe mailing list