Author: scabanovich
Date: 2008-10-23 13:03:19 -0400 (Thu, 23 Oct 2008)
New Revision: 11112
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/ModelObjectStorageEditorInput.java
Log:
JBIDE-2494
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/ModelObjectStorageEditorInput.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/ModelObjectStorageEditorInput.java 2008-10-23
15:25:16 UTC (rev 11111)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/ModelObjectStorageEditorInput.java 2008-10-23
17:03:19 UTC (rev 11112)
@@ -21,6 +21,7 @@
import org.jboss.tools.common.model.*;
import org.jboss.tools.common.model.filesystems.impl.*;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.util.FileUtil;
public class ModelObjectStorageEditorInput extends ModelObjectEditorInput implements
IStorageEditorInput {
@@ -40,7 +41,19 @@
ByteArrayInputStream b = null;
if(object instanceof FileAnyImpl) {
FileAnyImpl f = (FileAnyImpl)object;
- b = new ByteArrayInputStream(f.getAsText().getBytes());
+ String s = f.getAsText();
+ String encoding = FileUtil.getEncoding(s);
+ byte[] bs = null;
+ if(encoding == null) {
+ bs = s.getBytes();
+ } else {
+ try {
+ bs = s.getBytes(encoding);
+ } catch (UnsupportedEncodingException e) {
+ bs = s.getBytes();
+ }
+ }
+ b = new ByteArrayInputStream(bs);
} else {
b = new ByteArrayInputStream(new byte[0]);
}