Bug 114069 - [About] The character of UTF-8 in .log file is not correctly displayed by Web browser
Summary: [About] The character of UTF-8 in .log file is not correctly displayed by Web...
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords: nl
Depends on:
Blocks:
 
Reported: 2005-10-28 03:15 EDT by Hiroyuki Inaba CLA
Modified: 2019-09-06 16:17 EDT (History)
0 users

See Also:


Attachments
Screen Shot (631.34 KB, image/jpeg)
2005-10-28 20:45 EDT, Hiroyuki Inaba CLA
no flags Details
screenshot (402.95 KB, image/jpeg)
2005-10-28 20:52 EDT, Hiroyuki Inaba CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hiroyuki Inaba CLA 2005-10-28 03:15:15 EDT
The character of UTF-8 (Ex> Japanese) in .log file is not correctly displayed 
by Web browser.

In org.eclipse.ui.workbench plug-in
package: org.eclipse.ui.internal.dialogs
Class: AboutSystemDialog
Method: makeDisplayCopy (line=263)

It is a cause to use FileReader & FileWriter by the copy processing of .log 
file. 
It is necessary to use FileInputStream & FileOutputStream.
Comment 1 Kim Horne CLA 2005-10-28 10:26:54 EDT
Not sure where to punt this...
Comment 2 Karice McIntyre CLA 2005-10-28 11:48:02 EDT
I don't understand the problem description.  Are you saying there are 
characteres in the .log file that don't display correctly (appear as garbage 
characters) when you open that file in a web browser?  Can you provide a screen 
capture of the problem?
Comment 3 Hiroyuki Inaba CLA 2005-10-28 20:45:59 EDT
Created attachment 28973 [details]
Screen Shot

IE - view .metadata/org.eclipse.ui.workbench/log
Notepad - view .metadata/.log
And, dump .metadata/org.eclipse.ui.workbench/log & .metadata/.log
Comment 4 Hiroyuki Inaba CLA 2005-10-28 20:52:56 EDT
Created attachment 28974 [details]
screenshot

re-upload
Comment 5 Karice McIntyre CLA 2005-10-31 15:38:34 EST
What character (the unicode for it and a screen shot so we know what it looks 
like) should be displayed?   

There is also the possibility that a translated file may not be correct.  But 
first I need to track the string down.  Can you tell me what that message 
should say in English (roughly)?  Generally things that appear in the .log file 
are not translated (but it could be that same message appears elsewhere, in 
which case it being translated is ok).
Comment 6 Hiroyuki Inaba CLA 2005-11-01 06:37:14 EST
The problem occurs by MBCS 8142.
This character is a Japanese punctuation. 
It is English ".".

Please refer to the sample code.
It becomes a different code when using FileReader.

1) Result
MBCS: ffffff81 42
Java char: 3002
UTF-8: ffffffe3 ffffff80 ffffff82
FileInputStream: ffffffe3 ffffff80 ffffff82
byte to char: 3002
FileReader: 7e32

2) Sample code
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;

public class sample {

	public sample() {
	}
	
	private static void dump(String name, byte[] buf, int len) {
		System.out.print(name + ":");
		for(int i=0; i<len; i++) {
			System.out.print(" " + Integer.toHexString((int)buf
[i]));
		}
		System.out.println("");
	}

	private static void dump(String name, char[] buf, int len) {
		System.out.print(name + ":");
		for(int i=0; i<len; i++) {
			System.out.print(" " + Integer.toHexString((int)buf
[i]));
		}
		//System.out.print(" ");
		//for(int i=0; i<len; i++) {
		//	System.out.print(buf[i]);
		//}
		System.out.println("");
	}

	public static void main(String[] args) {
		FileOutputStream fos;
		try {
			byte[] buf = new byte[2];
			// set MBCS 0x8142
			buf[0]=(byte)0x81;
			buf[1]=(byte)0x42;
			dump("MBCS", buf, buf.length);
			String str = new String(buf);
			char[] chr = str.toCharArray();
			dump("Java char", chr, chr.length);
			buf = str.getBytes("UTF-8");
			dump("UTF-8", buf, buf.length);
			
			fos = new FileOutputStream("sample.txt");
			fos.write(buf);
			fos.close();
			
			buf = new byte[256];
			int len;
			
			FileInputStream fis = new FileInputStream
("sample.txt");
			len = fis.read(buf);
			dump("FileInputStream", buf, len);
			fis.close();
		
			str = new String(buf,"UTF-8");
			chr = str.toCharArray();
			dump("byte to char", chr, 1);

			chr = new char[256];
			FileReader fr = new FileReader("sample.txt");
			len = fr.read(chr);
			dump("FileReader", chr, len);
			fr.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

Comment 7 Karice McIntyre CLA 2006-03-20 14:35:21 EST
Are there any incorrect characters in the about system configuration dialog?  I can't justify changing the code in the about system dialog without being able to demonstrate an example of the problem.

Incorrect characters written to the .log file fall under runtime's jurisdiction, so a separate bug should be logged for that case.  Also note that the error log is not intended to have translated messages appear in it.  Though I can see how this happens if a message is re-used or translated when it should not have been.
Comment 8 Boris Bokowski CLA 2009-03-06 17:02:53 EST
Is this a difference between the file .metadata/.log and the file we use internally for the "View Error Log" button in the About dialog?
Comment 9 Eclipse Webmaster CLA 2019-09-06 16:17:41 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.