[Seaside] Zinc-Seaside: Problem with POSTing UTF-8 JSON

Philippe Marschall philippe.marschall at gmail.com
Fri Jun 28 07:57:59 UTC 2013


On Fri, Jun 28, 2013 at 8:51 AM, Norbert Hartl <norbert at hartl.name> wrote:
>
> Am 27.06.2013 um 00:01 schrieb Sven Van Caekenberghe <sven at stfx.eu>:
>
>> Hi Tomas,
>>
>> On 26 Jun 2013, at 22:46, Tomas Kukol <tomas.kukol at gmail.com> wrote:
>>
>>> Unbelievable, this code with Czech characters and MIME type set to text/json works well:
>>>
>>> GPRestfulHandler(WARestfulHandler)>>czechTestReal
>>>      <get>
>>>      <path: 'czechTestReal'>
>>>      <produces: 'text/json; charset=utf-8'>
>>>      ^ 'Czech is in Czech čeština.' asJson
>>>
>>> This code with Czech characters and MIME type set to application/json throws an error.
>>>
>>> GPRestfulHandler(WARestfulHandler)>>czechTestReal
>>>      <get>
>>>      <path: 'czechTestReal'>
>>>      <produces: 'application/json; charset=utf-8'>
>>>      ^ 'Czech is in Czech čeština.' asJson
>>>
>>> There is difference only in produces - text/json vs. application/json, but there are probably different stream - text vs. binary.
>>
>> Great that you found it !
>>
>> Indeed, consider:
>>
>> (WAMimeType fromString: 'text/json') isBinary. false
>> (WAMimeType fromString: 'application/json') isBinary. true
>>
>> (ZnMimeType fromString: 'text/json') isBinary. false
>> (ZnMimeType fromString: 'application/json') isBinary. false
>>
>> I made an explicit exception for application/json in ZnMimeType ;-)
>>
> Everytime I see text/binary issues when one talks about character encoding it feels like there is something really wrong! I think the concept of text/binary streams is a legacy thing that we need to get rid of.

Yes, sometimes it is tempting to throw it all away and start all over
with XStreams.

Cheers
Philippe


More information about the seaside mailing list