Solaris -vs- iconv

Jeff Sturm jsturm@one-point.com
Mon Mar 26 13:27:00 GMT 2001


Now that I am trying to "make check" on Solaris, I went back and reread
the iconv threads.

A bare "gcj" invocation fails on Solaris, which isn't very useful.
Passing --encoding=UTF-8 works, as does LANG=en_US.UTF-8 in my
environment.  But dejagnu needs some help, because it doesn't have the
--encoding hack and libtool supresses my LANG setting (why?).

It seems that Solaris iconv understands all of ISO8859-1, UTF-8,
UCS-2/UTF-16 and plain ASCII just fine.  The problem is that it cannot
translate between arbitrary combinations of those :(

So how do I proceed?

1) Hack libjava.exp for --encoding.

I've done this, but it's a little ugly... I had to get all the cases for
source/bytecode compiling, plus jv-scan.  But maybe I was doing something
wrong.

Also, this is no help to the Solaris user who actually needs to use "gcj
--encoding=ISO8859-1".

2) Hack lex.c to do a 2-step character translation.

The native Solaris iconv will translate anything to UTF-8, and there is a
builtin UTF-8 -> UCS-2 translator.  These could be chained to do want we
need.

But since this isn't needed for glibc, I wonder if Solaris is really the
special case?  Does anybody use iconv on any other platforms?

3) Forget about UCS-2 in lex.c.

I suppose there is a good reason for it, but I haven't stared at lex.c
long enough to figure out what.  Strings are converted back to UTF-8
before they are written anyhow.


Jeff




More information about the Java mailing list