From user-return-20616-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Wed Apr 25 10:59:34 2012 Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CC7DB9F0F for ; Wed, 25 Apr 2012 10:59:34 +0000 (UTC) Received: (qmail 24349 invoked by uid 500); 25 Apr 2012 10:59:33 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 24244 invoked by uid 500); 25 Apr 2012 10:59:33 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 24221 invoked by uid 99); 25 Apr 2012 10:59:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Apr 2012 10:59:32 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of pjcarvalho@gmail.com designates 209.85.213.180 as permitted sender) Received: from [209.85.213.180] (HELO mail-yx0-f180.google.com) (209.85.213.180) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Apr 2012 10:59:26 +0000 Received: by yenl4 with SMTP id l4so1248181yen.11 for ; Wed, 25 Apr 2012 03:59:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=swo5HGbFDsTE/VHKvdmPPgUE2q3tW/5HVT7+eL7VqRg=; b=ltDnxKfs+HY1knE7MdXld9LzVJjiM/gyUaVM3k9vZ7LMexRgWLuV3H8B/2PN1ShrOB PpV+V11LQo8n9ybqHa5IPxhhNIfIzGvWoCHBZBi2wmuJzitN68F/MAonQaaZ1Z8MHqQI ouSyQ2iGKsLrqZNSNAQttIcX+PnT2/3ls09G1nKIpGw+BYJrlTnrvmEQfQ665adq23On 7oxjdu8lCp3tigmXBzaU+HBSorPEUq/VrfeS3JxMGoovGCobpTQ5JSU4wcKRo4k1rsQm tI6VISOeQHIG9cLGcsaCnteu7QgabnZLKvNIHG8lyA5FEPuFIwJAgn6RIOUTq1SuAla8 XWow== MIME-Version: 1.0 Received: by 10.236.184.102 with SMTP id r66mr2005170yhm.46.1335351545466; Wed, 25 Apr 2012 03:59:05 -0700 (PDT) Received: by 10.100.13.15 with HTTP; Wed, 25 Apr 2012 03:59:05 -0700 (PDT) Date: Wed, 25 Apr 2012 12:59:05 +0200 Message-ID: Subject: CouchDB Invalid JSON UTF-8 From: Paulo Carvalho To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=20cf3056409d848d7704be7ec2da X-Virus-Checked: Checked by ClamAV on apache.org --20cf3056409d848d7704be7ec2da Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello, I am trying SQLToNoSQLImporter to import data to a couchDB database from a Postgresql database. I configured correctly the import.properties and db-data-config files. When I execute run.bat command (I am using windows), I get the following result: 07:50:14,568 INFO DataImporter:134 - Data Configuration loaded successfully 07:50:18,477 ERROR DataImporter:178 - ***** Data import failed. ********** Reason is : org.apache.http.HttpException: HTTP/1.1 400 Bad Request at net.sathis.export.sql.couch.CouchWriter.post(CouchWriter.java:68) at net.sathis.export.sql.couch.CouchWriter.writeToNoSQL(CouchWriter.java: 52) at net.sathis.export.sql.DocBuilder.execute(DocBuilder.java: 142) at net.sathis.export.sql.DataImporter.doFullImport(DataImporter.java:174) at net.sathis.export.sql.DataImporter.doDataImport(DataImporter.java:93) at net.sathis.export.sql.SQLToNoSQLImporter.main(SQLToNoSQLImporter.java: 19) As you can see, the configuration file is loaded correctly. In the couchDB database log file, I get the following error: [debug] [<0.147.0>] Invalid JSON: {{error, {126, "lexical error: invalid bytes in UTF8 string.\n"}}, <<"{\"docs\":[{\"_id\":\"0\",\"label \":\"Pas de taches\"},{\"_id\":\"1\",\"description\":\"Le pourcentage de recouvrement est < 2 %\",\"label\":\"Tr=E8s peu nombreuses\"},{\"_id \":\"2\",\"description\":\"Le p....... I think the problem happens because the text contained in the table has special characters ("=E8", etc.). The postgresql database is coded in UTF-8. Trying to solve the problem, I have written a little JSON file and i tried to insert it on my database. My JSON file content was the following: {"docs":[{"_id":"0","label ":"Pas de taches"}]} The result of inserting it on my database was: The result was: {"ok":true,"id":"doc_id","rev":"1- ffaec7bc2aa548ca8e5a9c697ea3eb64"} Next, I changed just a little my JSON file: I've put a special character (=E2): {"docs":[{"_id":"0","label ":"Pas de t=E2ches"}]} The result of inserting this JSON file on the database was: {"error":"bad_request","reason":"invalid_json"} Anyone can help me with this issue? Thank you Best regards. --20cf3056409d848d7704be7ec2da--