public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Morten Poulsen <morten@afdelingp.dk>
Cc: java@gcc.gnu.org
Subject: Re: outputting iso-8859-1 chars
Date: Wed, 24 Apr 2002 22:48:00 -0000	[thread overview]
Message-ID: <874ri066pw.fsf@creche.redhat.com> (raw)
In-Reply-To: Morten Poulsen's message of "24 Apr 2002 23:33:14 +0200"

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1490 bytes --]

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

Morten> I want to output a char (eg. the Danish å, 229 in
Morten> ISO-8859-1). It works just fine when the class is compiled
Morten> with javac or gcj

You don't say what platform you're on.  I assume you're on Linux.

On Linux the Sun JVM assumes that the C locale uses ISO-8859-1, when
in fact it uses ASCII.  libgcj respects this difference and outputs
just ASCII, meaning that character > 0x7f is printed as `?'.

This is sort of a pedantic difference, I guess, but I think it is the
cause of your problem.

Morten> mortenp@marvin:/tmp$ gcj --encoding=iso-8859-1 --main=Hello Hello.java

FYI, `gcj --encoding' tells gcj the encoding of your .java file.  it
doesn't affect the runtime behavior of your program (well, it can,
since a given sequence of bytes in the input file can have a different
meaning).

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

Yes.  Internally all string constants are represented as UTF-8.  That
is how they are written to the assembler as well.  At runtime they are
turned into UCS-2 (Java String encoding).

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

Your problem is almost certainly on the printing end of things.  Try
setting your locale to something that uses ISO-8859-1.  Or try using
`new OutputStreamWriter (System.out, "ISO-8859-1")'

Tom

  reply	other threads:[~2002-04-24 22:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-24 15:56 Morten Poulsen
2002-04-24 22:48 ` Tom Tromey [this message]
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=874ri066pw.fsf@creche.redhat.com \
    --to=tromey@redhat.com \
    --cc=java@gcc.gnu.org \
    --cc=morten@afdelingp.dk \
    /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).