aboutsummaryrefslogtreecommitdiff
path: root/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
diff options
context:
space:
mode:
authorClaude Brisson <cbrisson@apache.org>2016-12-05 14:10:00 +0000
committerClaude Brisson <cbrisson@apache.org>2016-12-05 14:10:00 +0000
commit43448c9973225b3ad3c1be39db54e5d0561bb9e3 (patch)
treef0cdfb81a0bd402059a5547fc0fc49fe6d7e4c1a /velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
parent6c4e44eb70fb5eff4e26f0c47fc48b99159fa395 (diff)
downloadapache-velocity-engine-43448c9973225b3ad3c1be39db54e5d0561bb9e3.tar.gz
[engine] default encoding to UTF-8
git-svn-id: https://svn.apache.org/repos/asf/velocity/engine/trunk@1772670 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java')
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java25
1 files changed, 7 insertions, 18 deletions
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
index c3673f63..fb697520 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
@@ -190,7 +190,7 @@ public class RuntimeInstance implements RuntimeConstants, RuntimeServices
*/
private Map applicationAttributes = null;
private Uberspect uberSpect;
- private String encoding;
+ private String defaultEncoding;
/*
* Space gobbling mode
@@ -279,7 +279,7 @@ public class RuntimeInstance implements RuntimeConstants, RuntimeServices
public synchronized void reset()
{
this.configuration = new ExtProperties();
- this.encoding = null;
+ this.defaultEncoding = null;
this.evaluateScopeName = "evaluate";
this.eventCartridge = null;
this.initialized = false;
@@ -457,6 +457,9 @@ public class RuntimeInstance implements RuntimeConstants, RuntimeServices
configuration.load( inputStream );
+ /* populate 'defaultEncoding' member */
+ defaultEncoding = getString(INPUT_ENCODING, ENCODING_DEFAULT);
+
if (log.isDebugEnabled())
{
log.debug("Default Properties resource: {}", DEFAULT_RUNTIME_PROPERTIES);
@@ -1560,28 +1563,14 @@ public class RuntimeInstance implements RuntimeConstants, RuntimeServices
*/
private String getDefaultEncoding()
{
- if (encoding == null)
- {
- /*
- * first try to get the OS encoding
- */
- encoding = System.getProperty("file.encoding");
- if (encoding == null)
- {
- /*
- * then fall back to default
- */
- encoding = getString(INPUT_ENCODING, ENCODING_DEFAULT);
- }
- }
- return encoding;
+ return defaultEncoding;
}
/**
* Returns a <code>Template</code> from the resource manager.
* This method assumes that the character encoding of the
* template is set by the <code>input.encoding</code>
- * property. The default is platform dependant.
+ * property. The default is UTF-8.
*
* @param name The file name of the desired template.
* @return The template.