public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
* outputting iso-8859-1 chars
@ 2002-04-24 15:56 Morten Poulsen
  2002-04-24 22:48 ` Tom Tromey
  0 siblings, 1 reply; 7+ messages in thread
From: Morten Poulsen @ 2002-04-24 15:56 UTC (permalink / raw)
  To: java

Hi,

I want to output a char (eg. the Danish å, 229 in ISO-8859-1). It works
just fine when the class is compiled with javac or gcj
--encoding=ISO_8859-1 -C, and executed with a normal JVM. The class is
this:

class Hello {
    public final static void main(String[] args) {
        System.out.println("xxxåxxx");
    }
}

However, if I compile it to a native binary, it outputs a question mark
where the å should have been.

mortenp@marvin:/tmp$ gcj --encoding=iso-8859-1 --main=Hello Hello.java
mortenp@marvin:/tmp$ ./a.out 
xxx?xxx

The closest (I guess) hint I got when searching google was a patch at
http://gcc.gnu.org/ml/java-patches/2000-q4/msg00077.html which has the
line

+	buf[count++] = (byte) ((c > 0xff) ? '?' : c);

in "public class Output_8859_1 extends UnicodeToBytes". It outputs a
question mark if the character is out of range - but å shouldn't be out
of range.

I have compiled the class and looked at the string in the assembler
code. It looks unicode-ish?

mortenp@marvin:/tmp$ gcj --encoding=iso-8859-1 -S Hello.java            
mortenp@marvin:/tmp$ fgrep xxx Hello.s 
        .ascii  "xxx\303\245xxx"

I am using gcj 3.0.4 from Debian.

Isn't it possible to use ISO-8859-1 characters in strings, when using
gcj, or am I doing something wrong?

Thanks,
Morten

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-05-01 11:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-24 15:56 outputting iso-8859-1 chars Morten Poulsen
2002-04-24 22:48 ` Tom Tromey
2002-04-25  2:00   ` Morten Poulsen
2002-04-25  3:49     ` Oskar Liljeblad
2002-04-25 20:25       ` Morten Poulsen
2002-04-30  0:22         ` Tom Tromey
2002-05-01  4:09           ` Morten Poulsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).