Return-Path: X-Original-To: apmail-camel-issues-archive@minotaur.apache.org Delivered-To: apmail-camel-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 01F4E18DA4 for ; Thu, 25 Jun 2015 12:14:05 +0000 (UTC) Received: (qmail 97617 invoked by uid 500); 25 Jun 2015 12:14:04 -0000 Delivered-To: apmail-camel-issues-archive@camel.apache.org Received: (qmail 97576 invoked by uid 500); 25 Jun 2015 12:14:04 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 97566 invoked by uid 99); 25 Jun 2015 12:14:04 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Jun 2015 12:14:04 +0000 Date: Thu, 25 Jun 2015 12:14:04 +0000 (UTC) From: "Franz Forsthofer (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (CAMEL-8905) encoding problems in jsonpath MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Franz Forsthofer created CAMEL-8905: --------------------------------------- Summary: encoding problems in jsonpath Key: CAMEL-8905 URL: https://issues.apache.org/jira/browse/CAMEL-8905 Project: Camel Issue Type: Bug Components: camel-jsonpath Affects Versions: 2.15.2 Reporter: Franz Forsthofer Fix For: 2.16.0, 2.15.3 I detected three different encoding problems in jsonpath: - if jsonpath is called with an input stream which has an encoding different from the default encoding (given by Charset.defaultCharset()) then jsonpath still uses the default encoding. Error location in JsonPathEngine: } else if (json instanceof InputStream) { InputStream is = (InputStream) json; return path.read(is, Charset.defaultCharset().displayName(), configuration); - if jsonpath is called with a json file whose encoding is different from UTF-8, then jsonpath still parses the document with UTF-8. Error location in JsonPathEngine: } else if (json instanceof File) { File file = (File) json; return path.read(file, configuration); path.read(file, configuration) uses always UTF-8 - if jsonpath is called with an URL pointing to a JSON document whose encoding is different from UTF-8, then jsonPath still parses the document with UTF-8. Error location in JsonPathEngine: } else if (json instanceof URL) { URL url = (URL) json; return path.read(url, configuration); path.read(url, configuration) uses UTF-8 My solution proposal is to determine the encoding of the JSON documents automatically according to the specification RFC-4627 (https://www.ietf.org/rfc/rfc4627.txt; see chapter 3. Encoding) and then call the method path.read(jsonDocument,foundEncoding,configuration) with the found encoding. See attached patch. Actually I can commit the patch myself. However, I would like that somebody who is more familiar with jsonpath than I does review my patch. So please tell me if my patch can be accepted or not. I can then do the actual commit or I will discard the patch. -- This message was sent by Atlassian JIRA (v6.3.4#6332)