[Seaside] How to set the charset in WAHtmlErrorHandler

jtuchel at objektfabrik.de jtuchel at objektfabrik.de
Fri Sep 7 05:57:51 UTC 2018


Philippe,

Am 06.09.18 um 17:22 schrieb Philippe Marschall:
> Something like
>
> self handler charSet
> is probably better than hard coding utf-8.

agreed. Although WAHtmlErorHandler doesn't implement #handler. So I 
ended up with this:


         response

             internalError;

             contentType: ((WAMimeType textHtml) charset: self requestContext charSet);


Thanks for your tip.

For the record: if the error handler gets rendered as a child in the 
component tree, that setting of charset is not necessary, but it is 
necessare if the Error handler is the main component. Special characters 
might be wrong then if the server side is not using utf-8. It may even 
have such strange effects like a Firefox on Mac using a 1252 code page 
(which I thought is Windows specific...).


Joachim



> Cheers
> Philippe
>
>
>
> On Thu, Sep 6, 2018 at 3:24 PM Johan Brichau <johan at inceptive.be> wrote:
>> Something along these lines:
>> E.g. In the handleDefault: method:
>>
>>          errorDialog := WARenderCanvas builder
>>                                          fullDocument: true;
>>                                          rootBlock: [ :root | root beHtml5; title: anException description ];
>>                                          render: [ :html |  … whatever you want ... ].
>>
>>          self requestContext respond: [ :response |
>>                  response
>>                          internalError;
>>                          contentType: ((WAMimeType textHtml) charset: 'utf-8’);
>>                          nextPutAll: errorDialog ]
>>
>>
>> warning: coded in email editor ;)
>> Take a look at WAHtmlErrorHandler as well
>>
>> cheers
>> Johan
>>
>>> On 6 Sep 2018, at 14:50, jtuchel at objektfabrik.de wrote:
>>>
>>> Hi there,
>>>
>>>
>>> I must be sitting on my brain at the moment...
>>>
>>> How do I set the charset=utf-8 header in a WAHtmlErrorHandler subclass?
>>>
>>>
>>> Joachim
>>>
>>> _______________________________________________
>>> seaside mailing list
>>> seaside at lists.squeakfoundation.org
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>> _______________________________________________
>> seaside mailing list
>> seaside at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside




More information about the seaside mailing list