[Seaside] Understanding encodings in Seaside 3.0

John Pierce john at pierce.name
Tue May 25 23:08:55 UTC 2010


My Configuration:

1. Mac running Squeak VM 4.2.2b1
2. Using Pharo 1.0 image
3. Installed Seaside 3.0a5 from seaside.st builder script
4. Using Comanche HTTP server

Background:

I am trying to write a SeaKEdtior (pronounced CKEditor) class that
extends WAFileLibrary. Instead of embedding all the numerous
JavaScript, CSS, and otherwise files from CKEditor.com, I just want to
unzip them in my image's default directory and serve them directly
from Squeak using Seaside's file handler and my custom SeaKEditor
class that streams content from the file system.

Why? Because CKEditor has many subdirectories nested pretty deep that
makes it pretty hard to serve using a standard WAFileLibrary subclass.
My extension works pretty well, but I have a problem with some of the
JS files are not standard UTF-8 ASCII, but actually have some unicode
(UTF-16?) in them making them wide strings in Pharo when I stream them
in.

With no encoding (default configuration) in the Seaside Control Panel,
one of the most critical JS files for CKEditor gets all messed up
(only about half of the ckeditor.js file gets returned by Seaside). I
suspect it is because the file comes in as a wide string and the size
is off by a factor of 2 when Comanche or Seaside return the file.

Anyways, so I thought a simple answer was to change my Seaside Control
Panel to actually use an encoding. I guess I don't understand
encodings in Seaside 3.0 because if I literally pick any encoding
other than the "none encoding" for Seaside 3.0 then pretty much
nothing works. The config app doesn't work, the counter app doesn't
work, no app really works at all until I set encodings back to none.
Here's some sample output from the config app when I use UTF-16
encoding:

<�!�D�O�C�T�Y�P�E� �h�t�m�l� �P�U�B�L�I�C� �"�-�/�/�W�3�C�/�/�D�T�D�
�X�H�T�M�L� �1�.�0� �S�t�r�i�c�t�/�/�E�N�"�
�"�h�t�t�p�:�/�/�w�w�w�.�w�3�.�o�r�g�/�T�R�/�x�h�t�m�l�1�/�D�T�D�/�x�h�t�m�l�1�-�s�t�r�i�c�t�.�d�t�d�"�>�

What am I doing wrong? I am stuck. If the answer is that I have to
configure each application to tell the browser what encoding is coming
back, how do you do that in Seaside 3.0a5 and how do you do that for a
subclass of WAFileLibrary?

And I know I should just run these static files from Apache in front
of Seaside. That's great for production but I'm try to develop an
image-only solution for my development efforts to keep it super
simple.

Any tips would be great. Sorry I'm so long winded.

Regards,

John

If you can find a path with no obstacles, it probably doesn't lead
anywhere. -- Frank A. Clark


More information about the seaside mailing list