You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2018/04/13 07:02:18 UTC

[camel] branch camel-2.20.x updated: CAMEL-12424: Fixed set charset from content-type if there are values after it. Thanks to Fabricio Guimarães Pellegrini for the patch.

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-2.20.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-2.20.x by this push:
     new 447807f  CAMEL-12424: Fixed set charset from content-type if there are values after it. Thanks to Fabricio Guimarães Pellegrini for the patch.
447807f is described below

commit 447807f2425b0b501ed0af71a67bb158a02427b1
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Apr 13 09:00:57 2018 +0200

    CAMEL-12424: Fixed set charset from content-type if there are values after it. Thanks to Fabricio Guimarães Pellegrini for the patch.
---
 .../src/main/java/org/apache/camel/http/common/HttpHelper.java      | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpHelper.java b/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpHelper.java
index b03725e..d215fba 100644
--- a/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpHelper.java
+++ b/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpHelper.java
@@ -89,10 +89,8 @@ public final class HttpHelper {
     @SuppressWarnings("deprecation")
     public static void setCharsetFromContentType(String contentType, Exchange exchange) {
         if (contentType != null) {
-            // find the charset and set it to the Exchange
-            int index = contentType.indexOf("charset=");
-            if (index > 0) {
-                String charset = contentType.substring(index + 8);
+            String charset = getCharsetFromContentType(contentType);
+            if (charset != null) {
                 exchange.setProperty(Exchange.CHARSET_NAME, IOConverter.normalizeCharset(charset));
             }
         }

-- 
To stop receiving notification emails like this one, please contact
davsclaus@apache.org.