Author: fmeschbe
Date: Sun Sep 28 23:28:04 2008
New Revision: 699995
URL: http://svn.apache.org/viewvc?rev=699995&view=rev
Log:
SLING-679 Only set default character encoding if content type
is a text/ content type.
Modified:
incubator/sling/trunk/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/DefaultSlingScript.java
Modified: incubator/sling/trunk/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/DefaultSlingScript.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/DefaultSlingScript.java?rev=699995&r1=699994&r2=699995&view=diff
==============================================================================
--- incubator/sling/trunk/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/DefaultSlingScript.java
(original)
+++ incubator/sling/trunk/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/DefaultSlingScript.java
Sun Sep 28 23:28:04 2008
@@ -206,13 +206,20 @@
props.setRequest((SlingHttpServletRequest) req);
props.setResponse((SlingHttpServletResponse) res);
- res.setCharacterEncoding("UTF-8");
// try to set content type
final String contentType = request.getResponseContentType();
- if ( contentType != null ) {
+ if (contentType != null) {
res.setContentType(contentType);
+
+ // only set the character encoding for text/ content types
+ // see SLING-679
+ if (contentType.startsWith("text/")) {
+ res.setCharacterEncoding("UTF-8");
+ }
} else {
- logger.warn("No response content type defined for request {}.", request.getRequestURI());
+ logger.debug(
+ "service:No response content type defined for request {}.",
+ request.getRequestURI());
}
// evaluate the script now using the ScriptEngine
|