You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Bruno Ronchetti <br...@mac.com> on 2010/01/25 13:12:23 UTC
Snow Leopard - invalid UTF-8 JSON
Hi everyone,
when querying a view I continue getting this "invalid UTF-8 JSON" problem that does not get away.
The database contains only two documents, each one has only one attribute. The view is using the attribute as a key, like that:
{
"_id": "_design/members",
"_rev": "1-ed85d9ceec4b2875a2459070eb9cc3eb",
"language": "javascript",
"views": {
"by_member": {
"map": "function(doc) {\nif (doc.member)\n emit(doc.member, doc);\n}"
}
}
}
This tinypic http://tinypic.com/view.php?pic=dwdy60&s=6 contains the view as it appears in Futon.
But when I try:
curl -X GET http://localhost:5984/pbo_members/_design/members/_view/by_member?key="pietro"
I get:
[error] [<0.5980.0>] attempted upload of invalid JSON pietro
[info] [<0.5980.0>] 127.0.0.1 - - 'GET' /pbo_members/_design/members/_view/by_member?key=pietro 400
I have rebuilt from yesterday from trunk and am now on 0.11.0b902541. The only other "strange thing" that I am aware of, is that I have 3 tests failing (changes, oauth and rev_stemming).
I thought about an authorization issue and have read and enacted everything i've found on the topic. I am still in the Admin Party, by the way.
I am on mac and snow leopard 10.6.2.
Any pointers to help me out?
Thanks a lot. Bruno.
Re: Snow Leopard - invalid UTF-8 JSON
Posted by Paul Davis <pa...@gmail.com>.
Single quoting in the shell will also alleviate the issue and can make
it easier to read.
$ curl -X GET 'http://localhost:5984/pbo_members/_design/members/_view/by_member?key="pietro"'
Paul Davis
On Mon, Jan 25, 2010 at 1:11 PM, Markus Jelsma <ma...@buyways.nl> wrote:
> Hello Bruno,
>
>
> How about encoding your URL?
>
> curl -X GET
> http://localhost:5984/pbo_members/_design/members/_view/by_member?key=%22pietro%22
>
> This will do the trick. Read more in the wiki on this subject. Sometimes
> slashes need encoding, sometimes they don't.
>
>
> Cheers,
>
>
>>Hi everyone,
>>
>>when querying a view I continue getting this "invalid UTF-8 JSON" problem
>> that does not get away.
>>
>>The database contains only two documents, each one has only one attribute.
>> The view is using the attribute as a key, like that: {
>> "_id": "_design/members",
>> "_rev": "1-ed85d9ceec4b2875a2459070eb9cc3eb",
>> "language": "javascript",
>> "views": {
>> "by_member": {
>> "map": "function(doc) {\nif (doc.member)\n emit(doc.member,
>> doc);\n}" }
>> }
>>}
>>
>>This tinypic http://tinypic.com/view.php?pic=dwdy60&s=6 contains the
>> view as it appears in Futon.
>>
>>But when I try:
>>
>> curl -X GET
>> http://localhost:5984/pbo_members/_design/members/_view/by_member?key="piet
>>ro"
>>
>>I get:
>>
>> [error] [<0.5980.0>] attempted upload of invalid JSON pietro
>> [info] [<0.5980.0>] 127.0.0.1 - - 'GET'
>> /pbo_members/_design/members/_view/by_member?key=pietro 400
>>
>>
>>I have rebuilt from yesterday from trunk and am now on 0.11.0b902541. The
>> only other "strange thing" that I am aware of, is that I have 3 tests
>> failing (changes, oauth and rev_stemming).
>>
>>I thought about an authorization issue and have read and enacted everything
>> i've found on the topic. I am still in the Admin Party, by the way.
>>
>>I am on mac and snow leopard 10.6.2.
>>
>>Any pointers to help me out?
>>
>>Thanks a lot. Bruno.
>
> Markus Jelsma - Technisch Architect - Buyways BV
> http://www.linkedin.com/in/markus17
> 050-8536620 / 06-50258350
>
>
Re: Snow Leopard - invalid UTF-8 JSON
Posted by Bruno Ronchetti <br...@mac.com>.
Markus,
yes it works also here.
I misinterpreted Paul's comment and simply swapped the double quotes for single quotes... guess it shows that I am a beginner.
Thanks for taking the time to point out my error.
Regards. Bruno.
On 25/gen/2010, at 19.44, Markus Jelsma wrote:
> Bruno,
>
>
> Paul's suggestion actually does work, encapsulating the entire URL (or
> your POST/PUT data with -d) is required if you need more than one query
> parameter. Otherwise the & will detach curl from your TTY and everything
> will go wrong ;)
>
> Both following examples work properly, perhaps you did something wrong?
>
>
> markus@relax:~$ curl -X GET
> http://localhost:5984/doclib/_design/docs/_view/getByName?key=%22Nature%22
> {"total_rows":3247,"offset":1829,"rows":[]}
>
> markus@relax:~$ curl -X GET
> 'http://localhost:5984/doclib/_design/docs/_view/getByName?key="Nature"'
> {"total_rows":3247,"offset":1829,"rows":[]}
>
>
>
> Cheers,
>
> Bruno Ronchetti zei:
>> Markus, Paul
>>
>> thanks a lot. Escaping works indeed, single quoting does not however.
>>
>> I will need to study the wiki and understand what is going on here.
>>
>> Regards. Bruno
>>
>>
>>
>> On 25/gen/2010, at 19.11, Markus Jelsma wrote:
>>
>>> Hello Bruno,
>>>
>>>
>>> How about encoding your URL?
>>>
>>> curl -X GET
>>> http://localhost:5984/pbo_members/_design/members/_view/by_member?key=%22pietro%22
>>>
>>> This will do the trick. Read more in the wiki on this subject.
>>> Sometimes slashes need encoding, sometimes they don't.
>>>
>>>
>>> Cheers,
>>>
>>>
>>>> Hi everyone,
>>>>
>>>> when querying a view I continue getting this "invalid UTF-8 JSON"
>>>> problem that does not get away.
>>>>
>>>> The database contains only two documents, each one has only one
>>>> attribute. The view is using the attribute as a key, like that: {
>>>> "_id": "_design/members",
>>>> "_rev": "1-ed85d9ceec4b2875a2459070eb9cc3eb",
>>>> "language": "javascript",
>>>> "views": {
>>>> "by_member": {
>>>> "map": "function(doc) {\nif (doc.member)\n emit(doc.member,
>>>> doc);\n}" }
>>>> }
>>>> }
>>>>
>>>> This tinypic http://tinypic.com/view.php?pic=dwdy60&s=6
>>>> contains the view as it appears in Futon.
>>>>
>>>> But when I try:
>>>>
>>>> curl -X GET
>>>> http://localhost:5984/pbo_members/_design/members/_view/by_member?key="piet
>>>> ro"
>>>>
>>>> I get:
>>>>
>>>> [error] [<0.5980.0>] attempted upload of invalid JSON pietro
>>>> [info] [<0.5980.0>] 127.0.0.1 - - 'GET'
>>>> /pbo_members/_design/members/_view/by_member?key=pietro 400
>>>>
>>>>
>>>> I have rebuilt from yesterday from trunk and am now on 0.11.0b902541.
>>>> The only other "strange thing" that I am aware of, is that I have 3
>>>> tests failing (changes, oauth and rev_stemming).
>>>>
>>>> I thought about an authorization issue and have read and enacted
>>>> everything i've found on the topic. I am still in the Admin Party,
>>>> by the way.
>>>>
>>>> I am on mac and snow leopard 10.6.2.
>>>>
>>>> Any pointers to help me out?
>>>>
>>>> Thanks a lot. Bruno.
>>>
>>> Markus Jelsma - Technisch Architect - Buyways BV
>>> http://www.linkedin.com/in/markus17
>>> 050-8536620 / 06-50258350
>>>
>
>
>
Re: Snow Leopard - invalid UTF-8 JSON
Posted by Markus Jelsma <ma...@buyways.nl>.
Bruno,
Paul's suggestion actually does work, encapsulating the entire URL (or
your POST/PUT data with -d) is required if you need more than one query
parameter. Otherwise the & will detach curl from your TTY and everything
will go wrong ;)
Both following examples work properly, perhaps you did something wrong?
markus@relax:~$ curl -X GET
http://localhost:5984/doclib/_design/docs/_view/getByName?key=%22Nature%22
{"total_rows":3247,"offset":1829,"rows":[]}
markus@relax:~$ curl -X GET
'http://localhost:5984/doclib/_design/docs/_view/getByName?key="Nature"'
{"total_rows":3247,"offset":1829,"rows":[]}
Cheers,
Bruno Ronchetti zei:
> Markus, Paul
>
> thanks a lot. Escaping works indeed, single quoting does not however.
>
> I will need to study the wiki and understand what is going on here.
>
> Regards. Bruno
>
>
>
> On 25/gen/2010, at 19.11, Markus Jelsma wrote:
>
>> Hello Bruno,
>>
>>
>> How about encoding your URL?
>>
>> curl -X GET
>> http://localhost:5984/pbo_members/_design/members/_view/by_member?key=%22pietro%22
>>
>> This will do the trick. Read more in the wiki on this subject.
>> Sometimes slashes need encoding, sometimes they don't.
>>
>>
>> Cheers,
>>
>>
>>> Hi everyone,
>>>
>>> when querying a view I continue getting this "invalid UTF-8 JSON"
>>> problem that does not get away.
>>>
>>> The database contains only two documents, each one has only one
>>> attribute. The view is using the attribute as a key, like that: {
>>> "_id": "_design/members",
>>> "_rev": "1-ed85d9ceec4b2875a2459070eb9cc3eb",
>>> "language": "javascript",
>>> "views": {
>>> "by_member": {
>>> "map": "function(doc) {\nif (doc.member)\n emit(doc.member,
>>> doc);\n}" }
>>> }
>>> }
>>>
>>> This tinypic http://tinypic.com/view.php?pic=dwdy60&s=6
>>> contains the view as it appears in Futon.
>>>
>>> But when I try:
>>>
>>> curl -X GET
>>> http://localhost:5984/pbo_members/_design/members/_view/by_member?key="piet
>>> ro"
>>>
>>> I get:
>>>
>>> [error] [<0.5980.0>] attempted upload of invalid JSON pietro
>>> [info] [<0.5980.0>] 127.0.0.1 - - 'GET'
>>> /pbo_members/_design/members/_view/by_member?key=pietro 400
>>>
>>>
>>> I have rebuilt from yesterday from trunk and am now on 0.11.0b902541.
>>> The only other "strange thing" that I am aware of, is that I have 3
>>> tests failing (changes, oauth and rev_stemming).
>>>
>>> I thought about an authorization issue and have read and enacted
>>> everything i've found on the topic. I am still in the Admin Party,
>>> by the way.
>>>
>>> I am on mac and snow leopard 10.6.2.
>>>
>>> Any pointers to help me out?
>>>
>>> Thanks a lot. Bruno.
>>
>> Markus Jelsma - Technisch Architect - Buyways BV
>> http://www.linkedin.com/in/markus17
>> 050-8536620 / 06-50258350
>>
Re: Snow Leopard - invalid UTF-8 JSON
Posted by Bruno Ronchetti <br...@mac.com>.
Markus, Paul
thanks a lot. Escaping works indeed, single quoting does not however.
I will need to study the wiki and understand what is going on here.
Regards. Bruno
On 25/gen/2010, at 19.11, Markus Jelsma wrote:
> Hello Bruno,
>
>
> How about encoding your URL?
>
> curl -X GET
> http://localhost:5984/pbo_members/_design/members/_view/by_member?key=%22pietro%22
>
> This will do the trick. Read more in the wiki on this subject. Sometimes
> slashes need encoding, sometimes they don't.
>
>
> Cheers,
>
>
>> Hi everyone,
>>
>> when querying a view I continue getting this "invalid UTF-8 JSON" problem
>> that does not get away.
>>
>> The database contains only two documents, each one has only one attribute.
>> The view is using the attribute as a key, like that: {
>> "_id": "_design/members",
>> "_rev": "1-ed85d9ceec4b2875a2459070eb9cc3eb",
>> "language": "javascript",
>> "views": {
>> "by_member": {
>> "map": "function(doc) {\nif (doc.member)\n emit(doc.member,
>> doc);\n}" }
>> }
>> }
>>
>> This tinypic http://tinypic.com/view.php?pic=dwdy60&s=6 contains the
>> view as it appears in Futon.
>>
>> But when I try:
>>
>> curl -X GET
>> http://localhost:5984/pbo_members/_design/members/_view/by_member?key="piet
>> ro"
>>
>> I get:
>>
>> [error] [<0.5980.0>] attempted upload of invalid JSON pietro
>> [info] [<0.5980.0>] 127.0.0.1 - - 'GET'
>> /pbo_members/_design/members/_view/by_member?key=pietro 400
>>
>>
>> I have rebuilt from yesterday from trunk and am now on 0.11.0b902541. The
>> only other "strange thing" that I am aware of, is that I have 3 tests
>> failing (changes, oauth and rev_stemming).
>>
>> I thought about an authorization issue and have read and enacted everything
>> i've found on the topic. I am still in the Admin Party, by the way.
>>
>> I am on mac and snow leopard 10.6.2.
>>
>> Any pointers to help me out?
>>
>> Thanks a lot. Bruno.
>
> Markus Jelsma - Technisch Architect - Buyways BV
> http://www.linkedin.com/in/markus17
> 050-8536620 / 06-50258350
>
Re: Snow Leopard - invalid UTF-8 JSON
Posted by Markus Jelsma <ma...@buyways.nl>.
Hello Bruno,
How about encoding your URL?
curl -X GET
http://localhost:5984/pbo_members/_design/members/_view/by_member?key=%22pietro%22
This will do the trick. Read more in the wiki on this subject. Sometimes
slashes need encoding, sometimes they don't.
Cheers,
>Hi everyone,
>
>when querying a view I continue getting this "invalid UTF-8 JSON" problem
> that does not get away.
>
>The database contains only two documents, each one has only one attribute.
> The view is using the attribute as a key, like that: {
> "_id": "_design/members",
> "_rev": "1-ed85d9ceec4b2875a2459070eb9cc3eb",
> "language": "javascript",
> "views": {
> "by_member": {
> "map": "function(doc) {\nif (doc.member)\n emit(doc.member,
> doc);\n}" }
> }
>}
>
>This tinypic http://tinypic.com/view.php?pic=dwdy60&s=6 contains the
> view as it appears in Futon.
>
>But when I try:
>
> curl -X GET
> http://localhost:5984/pbo_members/_design/members/_view/by_member?key="piet
>ro"
>
>I get:
>
> [error] [<0.5980.0>] attempted upload of invalid JSON pietro
> [info] [<0.5980.0>] 127.0.0.1 - - 'GET'
> /pbo_members/_design/members/_view/by_member?key=pietro 400
>
>
>I have rebuilt from yesterday from trunk and am now on 0.11.0b902541. The
> only other "strange thing" that I am aware of, is that I have 3 tests
> failing (changes, oauth and rev_stemming).
>
>I thought about an authorization issue and have read and enacted everything
> i've found on the topic. I am still in the Admin Party, by the way.
>
>I am on mac and snow leopard 10.6.2.
>
>Any pointers to help me out?
>
>Thanks a lot. Bruno.
Markus Jelsma - Technisch Architect - Buyways BV
http://www.linkedin.com/in/markus17
050-8536620 / 06-50258350