Bug 14670 - [win32] gcj & high ascii: incorrectly translated / linux: fails to compile
Summary: [win32] gcj & high ascii: incorrectly translated / linux: fails to compile
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: libgcj (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 13892 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-03-21 16:15 UTC by Rutger Ovidius
Modified: 2016-09-30 22:51 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Sample .java class (336 bytes, text/plain)
2004-03-21 16:18 UTC, Rutger Ovidius
Details
Screenshot of win32 results. (12.51 KB, image/png)
2004-03-21 16:18 UTC, Rutger Ovidius
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rutger Ovidius 2004-03-21 16:15:17 UTC
On Linux: gcc version 3.4.0 20040131
TestD.java:12: error: unrecognized character in input stream.

On Win32: gcc version 3.4.0 20040316 (prerelease)
Compiles fine, but characters are either output as boxes or question marks.

The test app creates two labels (A and B)  The high bit ascii results when 
compiled:

1. All Sun's JAVA:

javac -classpath swt.jar TestD.java
java -classpath swt.jar;. TestD
A: OK
B: OK

2. Mixture of javac and GCJ.

javac -classpath swt.jar TestD.java
gcj -c TestD.class -I swt.jar
gcj --main=TestD TestD.o libswt.a

A: OK
B: Wrong. Has ?'s (question marks)

3. All GCJ.

gcj -c TestD.java -I swt.jar
gcj --main=TestD TestD.o libswt.a

A: Wrong. Has boxes.

I will attach the class to this message.
Comment 1 Rutger Ovidius 2004-03-21 16:18:05 UTC
Created attachment 5960 [details]
Sample .java class
Comment 2 Rutger Ovidius 2004-03-21 16:18:45 UTC
Created attachment 5961 [details]
Screenshot of win32 results.
Comment 3 Andrew Pinski 2004-03-21 16:37:02 UTC
does --encoding=UTF-8 help?
Comment 4 Rutger Ovidius 2004-03-21 17:25:37 UTC
No, it doesn't seem to make a difference. (win32 or linux)
Comment 5 Andrew Pinski 2004-12-12 21:34:05 UTC
*** Bug 13892 has been marked as a duplicate of this bug. ***
Comment 6 Tom Tromey 2004-12-14 20:13:10 UTC
If by "high ascii" you mean byte with the high bit
set, then you want to compile those with "--encoding ISO-8859-1"
or the like.

Whether this works on Windows, I don't know.  It depends on
whether iconv is available on that platform (or if you are
using libiconv)

What happens if you compile with "gcj -C" and then run the
resulting bytecode using Sun's "java"?  If this works, then the
problem is not in the compiler at all but is in the runtime's
choice of default character set.

Comment 7 Rutger Ovidius 2004-12-15 04:59:13 UTC
It isn't a compiling problem that I'm trying to illustrate.  TestD.java
(included above) has a line: String s = "<high ascii chars>" characters.    If
these characters were received over a network connection as a byte stream, they
would still be converted to a string via the "new String(byte[])" method, which
is used in TestD.java.

They would then be turned into a String, and displayed, as in the screenshot
attached above.  gcj doesn't seem to convert the characters properly (not in the
same was a sun's java anyway).   The testcase and screenshot hopefully
communicate what I mean.

Anyway, compiling to bytecode is separate issue:
gcc version 4.0.0 20041213 (experimental)
gcj -C --encoding=UTF-8 TestD.java
TestD.java:12: error: malformed UTF-8 character.
         String s = "&#9617;ñâRÇÇNÇåñ&#9617;";

gcj -C --encoding=ISO-8859-1 TestD.java
TestD.java:1: fatal error: unknown encoding: 'ISO-8859-1'
   This might mean that your locale's encoding is not supported
   by your system's iconv(3) implementation.  If you aren't trying
   to use a particular encoding for your input file, try the
   '--encoding=UTF-8' option
compilation terminated.

I have mingw msys iconv (GNU libiconv 1.8) on my system. 
Comment 8 Andrew Pinski 2016-09-30 22:51:27 UTC
Closing as won't fix as libgcj (and the java front-end) has been removed from the trunk.