> Am 01.05.2015 um 15:15 schrieb volkert <volk...@komponentenwerkstatt.de>:
> 
> I thought UTF-8 is the default encoding in case JSON Documents, and so for 
> the Content-Type: application/json.
> 
> I added "setCharSetUTF8" this Teapot-Output and all works fine now. :-)
> 
The combination assumption-character encoding is never a good one. It is 
something that is hard to debug if not done right. Character encoding should 
_always_ be negotiated. So like in most problems being explicit is superior to 
act on implicit things.
 
> Danke,

Bitte.

Norbert

> Volkert
> 
> Am 01.05.2015 um 14:20 schrieb Norbert Hartl:
>> You need to look at the headers of the request. I would assume the sender 
>> sets an Content-Type: application/json without charset. In that moment it is 
>> uncertain what has to be done because the server needs to assume what 
>> charset it might be and this tasks seldomly works out good.
>> In order to make it work set a content type of your entity this way
>> 
>> ZnMimeType applicationJson setCharSetUTF8
>> 
>> Now you send a Content-Type of application/json;charset=utf-8 and the server 
>> knows which character decoder to use. That should be it. So please always 
>> assign a char set to your sending data to make it more reliable what happens 
>> on the other end.
>> 
>> hope this helps,
>> 
>> Norbert
>>> Am 01.05.2015 um 14:13 schrieb volkert <volk...@komponentenwerkstatt.de 
>>> <mailto:volk...@komponentenwerkstatt.de>>:
>>> 
>>> I tried ZnClient new get: 'http:// <http:/><removed>/api/atm/801813'; 
>>> yourself and got.
>>> 
>>> <fdchdjab.png>
>>> 
>>> This is the Doc i see in Firefox.
>>> 
>>> <fceagiec.png>
>>> 
>>> The JSON is served with ZnServer / Teapot. ;-)
>>> 
>>> Volkert
>>> 
>>> 
>>> Am 01.05.2015 um 12:21 schrieb Sven Van Caekenberghe:
>>>> Hi Volkert,
>>>> 
>>>> Tip 1: use ZnClient and inspect the response in detail, more specifically 
>>>> to see whether the response content type specifies the encoding.
>>>> 
>>>>   ZnClient new get: 'http:// <http:/><removed>/api/atm/801813'; yourself.
>>>> 
>>>> Tip 2: you could try to force override the default encoding using 
>>>> ZnDefaultCharacterEncoder (see the class comment).
>>>> 
>>>> But recent Zn code defaults to UTF8 (see #withDefaultUTF8Decoding: and 
>>>> #withDefaultUTF8Encoding:). So I am curious to see the response headers.
>>>> 
>>>> HTH,
>>>> 
>>>> Sven
>>>> 
>>>>> On 01 May 2015, at 11:54, volkert <volk...@komponentenwerkstatt.de> 
>>>>> <mailto:volk...@komponentenwerkstatt.de> wrote:
>>>>> 
>>>>> Dear all,
>>>>> 
>>>>> i am trying to get a JSON Document with ZnEasy. The Document is UTF-8 
>>>>> encoded.
>>>>> 
>>>>> (ZnEasy get: 'http:// <http:/><removed>/api/atm/801813') entity string.
>>>>>     
>>>>> <gccacjeh.png>
>>>>> 
>>>>> Any hints?
>>>>> 
>>>>> Volkert
>>>>> 
>>>>> 
>>> 
>> 
> 

Reply via email to