couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Couchdb Wiki] Trivial Update of "Quirks_on_Windows" by DaveCottlehuber
Date Fri, 01 Jun 2012 12:28:29 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The "Quirks_on_Windows" page has been changed by DaveCottlehuber:
http://wiki.apache.org/couchdb/Quirks_on_Windows?action=diff&rev1=17&rev2=18

Comment:
improve content-type

   * cURL works just fine on Windows -- once you understand the [[http://technet.microsoft.com/en-us/library/cc723564.aspx|unwritten
rules of quoting]] which are very different to that on Unix. The standard example from CouchDB
the Definitive Guide will fail with a "Invalid UTF-8 JSON" error:
  
  {{{
- curl -H "Content-Type: application/json" -X PUT http://username:password@localhost:5984/albums/6e1295ed6c29495e54cc05947f18c8af
-d '{"title":"There is Nothing Left to Lose","artist":"Foo Fighters"}'
+ curl -H "Content-Type: application/json; charset=utf-8" -X PUT http://username:password@localhost:5984/albums/6e1295ed6c29495e54cc05947f18c8af
-d '{"title":"There is Nothing Left to Lose","artist":"Foo Fighters"}'
  }}}
   * the 2 alternatives are either to include your JSON-encoded data as a file:
  
  {{{
-  curl -H "Content-Type: application/json" -X PUT http://username:password@localhost:5984/albums/6e1295ed6c29495e54cc05947f18c8af
-d @foo.json
+  curl -H "Content-Type: application/json; charset=utf-8" -X PUT http://username:password@localhost:5984/albums/6e1295ed6c29495e54cc05947f18c8af
--data-binary @foo.json
  }}}
   * or to use one of the three [[http://technet.microsoft.com/en-us/library/cc723564.aspx|escape
character sequences]] ("" or a ^" or a \") for every internal quote, to get past the cmd.exe
shell
  
  {{{
- curl -H "Content-Type: application/json" -X PUT http://username:password@localhost:5984/albums/6e1295ed6c29495e54cc05947f18c8af
-d "{\"title\":\"There is Nothing Left to Lose\",\"artist\":\"Foo Fighters\"}"
+ curl -H "Content-Type: application/json; charset=utf-8" -X PUT http://username:password@localhost:5984/albums/6e1295ed6c29495e54cc05947f18c8af
-d "{\"title\":\"There is Nothing Left to Lose\",\"artist\":\"Foo Fighters\"}"
  }}}
  
  == Building from Source ==

Mime
View raw message