[squeak-dev] Re: UTF8 in JSON (was: Re: [ANN] WebClient and WebServer 1.0 for Squeak)

Igor Stasenko siguctua at gmail.com
Tue May 11 15:38:06 UTC 2010


On 11 May 2010 17:44, Hannes Hirzel <hannes.hirzel at gmail.com> wrote:
> On 5/10/10, radoslav hodnicak <rh at 4096.sk> wrote:
>>
>> Which JSON package/version are you using? I fixed a bug in the one
>> distributed with SCouchDB few weeks ago, where it didn't encode utf8
>> characters properly - the correct escaped form is \uNNNN - always padded
>> to 4 Ns. that's why you get that warning, yours is only 2-3
>>
>> rado
>
> I have been using
> http://www.squeaksource.com/JSON (over 7000 downloads)
> in combination with WebClient.
>
> Thank you Rado, I found
> http://www.squeaksource.com/SCouchDB/SCouchDB-Core-rh.8.mcz
> and will have a look at it.
> (Your comment: added handling of utf8 encoded input data - this is
> necessary for couchdb-lucene which sends results directly in utf8 and
> not \uNNNN encoded)
>
SCouchDB using a forked version of JSON package, which you can find in
SCouchDB repository
http://www.squeaksource.com/SCouchDB/JSON-Igor.Stasenko.34.mcz

If you looking for that method, it can be found in Json>>unescapeUnicode


> --Hannes
>
>
>> On Mon, 10 May 2010, Hannes Hirzel wrote:
>>
>>> The test case made simpler
>>>
>>> WebClient httpPut: host, '/notes/test7' content:
>>> '{"content":"\uC3\uA4s"}' type: 'text/plain'.
>>>
>>> gives back as answer: '{"error":"bad_request","reason":"invalid UTF-8
>>> JSON"}
>>> '
>>>
>>> whereas
>>>
>>> WebClient httpPut: host, '/notes/test8' content: '{"content":"abc"}'
>>> type: 'text/plain'.
>>>
>>> gives back
>>> '{"ok":true,"id":"test8","rev":"1-f40e52919735ae6775af3d388361b3da"}
>>> '
>>>
>>> --Hannes
>>
>>
>
>



-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list