public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
From: Morten Poulsen <morten@afdelingp.dk>
To: java@gcc.gnu.org
Subject: outputting iso-8859-1 chars
Date: Wed, 24 Apr 2002 15:56:00 -0000	[thread overview]
Message-ID: <1019683994.8904.26.camel@marvin> (raw)

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

             reply	other threads:[~2002-04-24 21:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-24 15:56 Morten Poulsen [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1019683994.8904.26.camel@marvin \
    --to=morten@afdelingp.dk \
    --cc=java@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).