Author: scabanovich
Date: 2008-10-23 13:04:02 -0400 (Thu, 23 Oct 2008)
New Revision: 11113
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/JarAccess.java
Log:
JBIDE-2494
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/JarAccess.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/JarAccess.java 2008-10-23
17:03:19 UTC (rev 11112)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/JarAccess.java 2008-10-23
17:04:02 UTC (rev 11113)
@@ -191,6 +191,8 @@
}
int length = 0;
BufferedInputStream bs = null;
+ String encoding = null;
+ boolean first = true;
try {
InputStream is = jar.getInputStream(jar.getEntry(path));
bs = new BufferedInputStream(is);
@@ -200,7 +202,15 @@
length = bs.read(b, 0, length);
if (length < 0)
break;
- sb.append(new String(b, 0, length));
+ if(first) {
+ first = false;
+ encoding = FileUtil.getEncoding(b);
+ }
+ if(encoding != null) {
+ sb.append(new String(b, 0, length, encoding));
+ } else {
+ sb.append(new String(b, 0, length));
+ }
}
return sb.toString();
} catch (IOException e) {
Show replies by date