+ used UTF-8 as the implicit encoding for reading scripts
This commit is contained in:
Costin Leau 2010-02-04 10:04:48 +00:00
parent 44626054ce
commit 0224cbc3de
1 changed files with 4 additions and 16 deletions

View File

@ -79,20 +79,9 @@ public class ResourceScriptSource implements ScriptSource {
synchronized (this.lastModifiedMonitor) { synchronized (this.lastModifiedMonitor) {
this.lastModified = retrieveLastModifiedTime(); this.lastModified = retrieveLastModifiedTime();
} }
Reader reader = null;
try { Reader reader = new InputStreamReader(this.resource.getInputStream(), "UTF-8");
// Try to get a FileReader first: generally more reliable.
reader = new FileReader(getResource().getFile());
}
catch (IOException ex) {
if (logger.isDebugEnabled()) {
logger.debug("Could not open FileReader for " + this.resource +
" - falling back to InputStreamReader", ex);
}
}
if (reader == null) {
reader = new InputStreamReader(this.resource.getInputStream());
}
return FileCopyUtils.copyToString(reader); return FileCopyUtils.copyToString(reader);
} }
@ -128,5 +117,4 @@ public class ResourceScriptSource implements ScriptSource {
public String toString() { public String toString() {
return this.resource.toString(); return this.resource.toString();
} }
} }