[Seaside] Special chars (euro-sign) and umlauts in Seaside

Philippe Marschall philippe.marschall at gmail.com
Mon Nov 20 10:15:50 UTC 2006

2006/11/19, Adrian Schmitt <adrian.schmitt at googlemail.com>:
> Hi,
> I was trying today to produce the euro sign &euro; on seaside output.
> And I have also text to display with umlauts and french characters
> like e-accent-aigu.

What encoding do these texts have?

> I found out I could patch WAAbstractHtmlBuilder in seaside-builder.
> This is what the initialize method now looks like:
> <code>
> initialize
> "WAHtmlBuilder initialize"
> HtmlCharacters _ Array new: 256.
> 0 to: 255 do: [:ea | HtmlCharacters at: ea + 1 put: ea asCharacter].
> #($" 'quot' $< 'lt' $& 'amp' $> 'gt'
>   $ä 'auml' $ö 'ouml' $ü 'uuml' $Ä 'Auml' $Ö 'Ouml' $Ü 'Uuml' $ß 'szlig'
>   $è 'egrave' $é 'eacute'
>   $€; 'euro') pairsDo:
>    [:c :s | HtmlCharacters at: (c asInteger + 1) put: ('&',s,';') ]
> </code>
> To activate it I had to run "WAAbstractHtmlBuilder initialize" in a
> workspace. Now I can type in all the characters mentioned above into
> seaside directly.
> It could be that some of the chars in the code above don't make the
> way from my editor to your desktop. But you could edit the array and
> correct or insert just the characters and codes you need. I found a
> list here, just scroll down to see the tables:
> http://de.selfhtml.org/html/referenz/zeichen.htm
> Does anyone know a better way to do what I did? How is
> internationalisation handled in squeak?

Squeak >= 3.8 uses "non-unified Unicode". See the class comment of Character.
use the #convertToEncoding: #convertFromEncoding: methods to convert Strings.

Basically use the correct sever adapter and charset setting for the
session and it should "just work" given all your Strings in the image
have the same encoding. The first step is to know what encoding the
Strings in your image have. The second is to know what encoding you
"pages" shall have.

> What if I get text for display
> from databases in different character-sets, how do I convert it the
> "seaside way" for correct html output?

Seaside does no conversion whatsoever (which would not be portable
anyway). The server adapters do the conversion (which are platform

This has the advantage that it gives you more options. So suppose you
database is utf-8 and your "pages" are utf-8 you can have utf-8
Strings in you image. So you don't have to convert from utf-8 to
WideString and back to utf-8.

However if you want to have WideStrings in your image you can also have that.

The same way you need to understand html for Seaside you also need
understand character encodings. Sorry, there's just no way around


More information about the Seaside mailing list