Uploaded image for project: 'CouchDB'
  1. CouchDB
  2. COUCHDB-1406

PUTing JSON with invalid UTF-8 returns no error message

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.1.1
    • 1.2, 1.2.1, 1.3
    • HTTP Interface
    • Debian testing

    • Dont Know

    Description

      I'm reading utf-8 documents from disk and embedding them in a json structure. Several of them contain invalid utf-8 characters. If I PUT to couchdb I get a stack trace in my debug log and the tcp connection is dropped--no http code is returned

      [Wed, 08 Feb 2012 17:58:55 GMT] [error] [<0.28906.4>] {error_report,<0.31.0>,
      {<0.28906.4>,crash_report,
      [[{initial_call,
      {mochiweb_acceptor,init,
      ['Argument__1','Argument__2','Argument__3']}},

      {pid,<0.28906.4>}

      ,

      {registered_name,[]}

      ,
      {error_info,
      {exit,
      {ucs,{bad_utf8_character_code}},
      [{xmerl_ucs,from_utf8,1,
      [

      {file,"xmerl_ucs.erl"}

      ,

      {line,185}

      ]},
      {mochijson2,json_encode_string,2,
      [

      {file,"mochijson2.erl"},{line,148}]},
      {mochijson2,'json_encode_proplist/2-fun-0',3,
      [{file,"mochijson2.erl"}

      ,

      {line,129}

      ]},
      {lists,foldl,3,[

      {file,"lists.erl"}

      ,

      {line,1197}

      ]},
      {mochijson2,json_encode_proplist,2,
      [

      {file,"mochijson2.erl"}

      ,

      {line,132}

      ]},
      {couch_httpd,send_json,4,
      [

      {file,"couch_httpd.erl"},{line,635}]},
      {couch_httpd,handle_request_int,5,
      [{file,"couch_httpd.erl"}

      ,

      {line,272}

      ]},
      {mochiweb_http,headers,5,
      [

      {file,"mochiweb_http.erl"}

      ,

      {line,126}

      ]}]}},

      {ancestors, [couch_httpd,couch_secondary_services, couch_server_sup,<0.32.0>]}

      ,

      {messages,[]}

      ,

      {links,[<0.113.0>,#Port<0.30990>]}

      ,
      {dictionary,
      [{mochiweb_request_body,
      <<"

      {\"id\":111,\"doc\":\"ker\\u0019 u\"}

      \n">>},

      {mochiweb_request_qs,[]}

      ,

      {mochiweb_request_recv,true}

      ,

      {jsonp,no_jsonp}

      ,

      {mochiweb_request_cookie,[]}

      ]},

      {trap_exit,false}

      ,

      {status,running}

      ,

      {heap_size,2584}

      ,

      {stack_size,24}

      ,

      {reductions,7048}

      ],
      []]}}

      Attachments

        Activity

          People

            rnewson Robert Newson
            svevang Sam Vevang
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: