This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
iconv on Solaris
- To: java at gcc dot gnu dot org
- Subject: iconv on Solaris
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Mon, 24 Sep 2001 01:34:46 -0700
Is it a known problem that things like BufferedReader do not
work on Solaris 2.8?
The problem is that libjava uses iconv on Solaris, converting from
646 to UCS-2. Unfortunately, the Solaris iconv for this case seems
to be broken. Here is an (ugly) test program:
#include <stdio.h>
#include <iconv.h>
int main () {
char input[12];
char output[12];
size_t inbytes = 1;
size_t outbytes = 12;
iconv_t cd;
const char *ic = input;
char *oc = output;
int r;
input[0] = ' ';
output[0] = output[1] = 0;
fprintf (stderr, "%x %x\n", ic, oc);
cd = iconv_open ("UCS-2", "646");
r = iconv(cd, &ic, &inbytes, &oc, &outbytes);
fprintf (stderr, "%x %x\n", ic, oc);
fprintf (stderr, "%d %d %d %d %d\n", r, output[0], output[1],
output[2], output[3]);
}
The output of this program is:
gcc test.c && ./a.out
ffbef900 ffbef8f0
ffbef901 ffbef8f4
0 -2 -1 0 32
Note that there are 4 bytes of output, even though we converted one
byte of 646 to UCS-2. Using UCS-2BE or UCS-2LE yields sensible
output; it seems that perhaps we should use one of those on Solaris?
Or am I crazy? (I am not smart about internationalization...)
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com