Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 349465

Summary: [1.7] Console view output scrambled when launching with UTF-8 or UTF-16 and latest IBM 1.7 JRE
Product: [Eclipse Project] JDT Reporter: Dani Megert <daniel_megert>
Component: DebugAssignee: Dani Megert <daniel_megert>
Status: RESOLVED NOT_ECLIPSE QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, dixaj48694, Michael_Rennie
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Test Case none

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.