outputting iso-8859-1 chars

Tom Tromey tromey@redhat.com
Tue Apr 30 00:22:00 GMT 2002


>>>>> "Morten" == Morten Poulsen <morten@afdelingp.dk> writes:

Morten> Are you using a newer version than 3.0.4 ?
Morten> $ LC_CTYPE=C ./a.out 
Morten> xxx?xxx
Morten> $ LC_CTYPE=en_GB ./a.out 
Morten> xxx?xxx

I looked at the 3.0 branch sources using cvsweb.  They have enough
support in them that this should work.

The default output encoding is chosen in libjava/java/lang/natSystem.cc.
Well, it is if various things are found by configure; in your case
this almost certainly happens since (1) Linux has all the features in
question, and (2) if we don't find the features we need we default to
ISO-8859-1 (which would contradict the results you see).

So I think the question is why you aren't seeing what we'd expect.

Try compiling and running this program:

#include <stdio.h>
#include <locale.h>
#include <langinfo.h>

int main ()
{
  char *x;
  setlocale (LC_CTYPE, "");
  x = nl_langinfo (CODESET);
  printf ("%s\n", x);
}


I get this:

    creche. ./a
    ANSI_X3.4-1968
    creche. LC_CTYPE=en_GB ./a
    ISO-8859-1


If this program doesn't print ISO-8859-1 (or some alias) when
LC_CTYPE=en_GB, then I think the problem is in your libc.  Otherwise
maybe the problem is in libjava; you'd have to do some debugging to
figure out what is going wrong.

Tom



More information about the Java mailing list