[Seaside] Re: setting the charset

Avi Bryant avi at beta4.com
Wed Jun 16 02:57:06 CEST 2004


On Jun 15, 2004, at 2:42 PM, Karel Zelnicek wrote:

> On Tue, 15 Jun 2004, Avi Bryant wrote:
>>
>> On Jun 15, 2004, at 2:08 PM, Karel Zelnicek wrote:
>>>
>>> 1) How can I tell the browser (e.g. opera or msie, not scamper) to 
>>> use
>>> iso-5589-2 encoding for seaside produced pages ? I know that there 
>>> must
>>> by some charset="..."  statement in head, but how can I put it there 
>>> ?
>>
>>
>>> 2) When I open the source for page produced by seaside, there is 
>>> <?xml
>>> version="1.0" encoding="UTF-8"?> at the beginning of that page. What
>>> does
>>> it mean ? If I were succesful in setting the charset, wouldn't this
>>> setting (encoding="UTF-8") override it ?
>>
>> Which version of Seaside are you using? Both of your questions depend
>> on that somewhat.

> Maybe Seaside2.5a3-avi.1

Ok.  If you upgrade to a more recent version (2.5a4 or 2.5a5), the XML 
prologue will be gone, and instead the charset is set in a Content-Type 
header.  You can see that this gets set in WAResponse>>initialize.  The 
simplest thing to do would be to modify that method.  A cleaner way 
would be to implement a custom WASession subclass for your application 
and override #respond: like so:

respond: aBlock
	|resp|
	^ super respond:
		[:url |
		resp := aBlock value: url.
		resp contentType: 'text/html; charset=iso-5589-2'.
		resp]

I haven't tested this code but I think it should work.

Avi



More information about the Seaside mailing list