add the ability to override defaultEncoding
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 ac62b87..3d77055 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
@@ -733,6 +733,9 @@ private void initializeProperties()
         if( overridingProperties != null )
         {
             configuration.combine(overridingProperties);
+
+            /* reinitialize defaultEncoding in case it is overridden */
+            defaultEncoding = getString(INPUT_ENCODING, ENCODING_DEFAULT);
         }
     }
 
diff --git a/velocity-engine-core/src/test/java/org/apache/velocity/runtime/RuntimeInstanceTest.java b/velocity-engine-core/src/test/java/org/apache/velocity/runtime/RuntimeInstanceTest.java
new file mode 100644
index 0000000..9b88e20
--- /dev/null
+++ b/velocity-engine-core/src/test/java/org/apache/velocity/runtime/RuntimeInstanceTest.java
@@ -0,0 +1,49 @@
+package org.apache.velocity.runtime;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.velocity.exception.ParseErrorException;
+import org.apache.velocity.exception.ResourceNotFoundException;
+import org.apache.velocity.runtime.resource.Resource;
+import org.apache.velocity.runtime.resource.ResourceManager;
+import org.junit.Test;
+
+public class RuntimeInstanceTest {
+
+    @Test
+    public void givenOverridenInputEncoding_whenInitializing_defaultEncodingIsOverridden() {
+        RuntimeInstance instance = new RuntimeInstance();
+        MockResourceManager manager = new MockResourceManager();
+        String value = "testDummyEncoding";
+        instance.addProperty(RuntimeConstants.INPUT_ENCODING, value);
+        instance.addProperty(RuntimeConstants.RESOURCE_MANAGER_INSTANCE, manager);
+        instance.init();
+
+        instance.getTemplate("some template");
+
+        assertEquals(value, manager.encoding);
+
+    }
+
+    class MockResourceManager implements ResourceManager {
+
+        String encoding = null;
+
+        @Override
+        public String getLoaderNameForResource(String resourceName) {
+            return null;
+        }
+
+        @Override
+        public Resource getResource(String resourceName, int resourceType, String encoding)
+                throws ResourceNotFoundException, ParseErrorException {
+            this.encoding = encoding;
+            return null;
+        }
+
+        @Override
+        public void initialize(RuntimeServices rs) {
+
+        }
+    }
+}