Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349465 - [1.7] Console view output scrambled when launching with UTF-8 or UTF-16 and latest IBM 1.7 JRE
Summary: [1.7] Console view output scrambled when launching with UTF-8 or UTF-16 and l...
Status: RESOLVED NOT_ECLIPSE
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-15 11:35 EDT by Dani Megert CLA
Modified: 2022-09-26 03:24 EDT (History)
3 users (show)

See Also:


Attachments
Test Case (1.53 KB, text/x-java)
2011-06-16 04:02 EDT, Dani Megert CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2011-06-15 11:35:20 EDT
3.7.

Console view output is scrambled when launching UTF-16 and latest IBM 1.7 JRE.

It works when using IBM 1.6 JRE or Oracle 1.7 JRE. It also works when launching outside Eclipse using -Dfile.encoding.

We need to figure out why it breaks in Eclipse.


Test Case:
1. start new workspace
2. paste this:
public class Bug {
	public static void main(String[] args) {
	}
}
3. create a launch configuration with
   - the encoding on the 'Common' tab to 'UTF-16'
   - "-showversion" VM argument on the 'Arguments' tab
4. Run
==> scrambled output in the Console view
Comment 1 Dani Megert CLA 2011-06-16 01:23:43 EDT
I'll take a look.
Comment 2 Dani Megert CLA 2011-06-16 03:54:44 EDT
It's not a regression on the Eclipse side: same problem in 3.5 and 3.6 too but it is a problem in Eclipse though, as the problem cannot be reproduced on the command line.

The problem can also be reproduced with earlier IBM JREs if 'java' is used in the launch configuration instead of 'javaw'. So we see two issues:
1. IBM 1.7 JRE changed 'javaw' to more match 'java' (but it's not mapped directly
   to 'javaw' as we see output on the command line.
2. IBM JREs produce garbage in the console when 'java' is used instead of 'javaw'

In addition, I also see the problem with UTF-8.
Comment 3 Dani Megert CLA 2011-06-16 04:02:13 EDT
Created attachment 198068 [details]
Test Case
Comment 4 Dani Megert CLA 2011-06-16 05:35:09 EDT
OK, that one was nasty to debug. In turns out that this is a bug in IBM JRE's com.ibm.jvm.io.ConsolePrintStream class:
- 'java' (console is requested ) hard-codes the encoding to 'IBM437'
- 'javaw' (no console is requested) it used to use file.encoding but now in 1.7
  it hard-codes the encoding to 'IBM850'

Eclipse uses 'javaw' by default, that's why we didn't see this bug so far.