Author: cbrisson
Date: Fri Jul 15 08:36:09 2016
New Revision: 1752800
URL: http://svn.apache.org/viewvc?rev=1752800&view=rev
Log:
default input encoding set to file.encoding System property (then to UTF-8 if
not present) ; removed unused OUTPUT_ENCODING property
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeSingleton.java
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java?rev=1752800&r1=1752799&r2=1752800&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java
Fri Jul 15 08:36:09 2016
@@ -231,11 +231,8 @@ public interface RuntimeConstants
/** The character encoding for the templates. Used by the parser in
processing the input streams. */
String INPUT_ENCODING = "input.encoding";
- /** Encoding for the output stream. Currently used by Anakia and
VelocityServlet */
- String OUTPUT_ENCODING = "output.encoding";
-
- /** Default Encoding is ISO-8859-1. */
- String ENCODING_DEFAULT = "ISO-8859-1";
+ /** Default Encoding is UTF-8 if not found in system. */
+ String ENCODING_DEFAULT = "UTF-8";
/** key name for uberspector. Multiple classnames can be specified,in
which case uberspectors will be chained. */
String UBERSPECT_CLASSNAME = "runtime.introspector.uberspect";
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java?rev=1752800&r1=1752799&r2=1752800&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
Fri Jul 15 08:36:09 2016
@@ -1527,7 +1527,17 @@ public class RuntimeInstance implements
{
if (encoding == null)
{
- encoding = getString(INPUT_ENCODING, ENCODING_DEFAULT);
+ /*
+ * 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;
}
@@ -1536,7 +1546,7 @@ public class RuntimeInstance implements
* 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 "ISO-8859-1"
+ * property. The default is platform dependant.
*
* @param name The file name of the desired template.
* @return The template.
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java?rev=1752800&r1=1752799&r2=1752800&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java
Fri Jul 15 08:36:09 2016
@@ -257,7 +257,7 @@ public interface RuntimeServices
* 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 "ISO-8859-1"
+ * property. The default is platform dependant.
*
* @param name The file name of the desired template.
* @return The template.
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeSingleton.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeSingleton.java?rev=1752800&r1=1752799&r2=1752800&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeSingleton.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeSingleton.java
Fri Jul 15 08:36:09 2016
@@ -282,7 +282,7 @@ public class RuntimeSingleton implements
* 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 "ISO-8859-1"
+ * property. The default is platform dependant.
*
* @param name The file name of the desired template.
* @return The template.