Return-Path: Delivered-To: apmail-incubator-sling-commits-archive@locus.apache.org Received: (qmail 41007 invoked from network); 29 Sep 2008 06:28:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 29 Sep 2008 06:28:55 -0000 Received: (qmail 33943 invoked by uid 500); 29 Sep 2008 06:28:54 -0000 Delivered-To: apmail-incubator-sling-commits-archive@incubator.apache.org Received: (qmail 33906 invoked by uid 500); 29 Sep 2008 06:28:53 -0000 Mailing-List: contact sling-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: sling-dev@incubator.apache.org Delivered-To: mailing list sling-commits@incubator.apache.org Received: (qmail 33897 invoked by uid 99); 29 Sep 2008 06:28:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 28 Sep 2008 23:28:53 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Sep 2008 06:28:00 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C7F4B23889B9; Sun, 28 Sep 2008 23:28:04 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r699995 - /incubator/sling/trunk/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/DefaultSlingScript.java Date: Mon, 29 Sep 2008 06:28:04 -0000 To: sling-commits@incubator.apache.org From: fmeschbe@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080929062804.C7F4B23889B9@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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