Special chars (euro-sign) and umlauts in Seaside

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Special chars (euro-sign) and umlauts in Seaside

Adrian Schmitt
Hi,

I was trying today to produce the euro sign € on seaside output.
And I have also text to display with umlauts and french characters
like e-accent-aigu.

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? 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?

Adrian
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Special chars (euro-sign) and umlauts in Seaside

Humber Aquino
Hi Adrian!

Try running WAKomEncoded startOn: 8080 if you're using a 3.8 image.
With a 3.9 image use WAKomEncoded39 startOn: 8080.

That will display even japanese characters(if you have the fonts installed).

I don't know if this was what you are looking for but i hope it helps :D



On 11/19/06, Adrian Schmitt <[hidden email]> wrote:

> 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.
>
> 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? 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?
>
> Adrian
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Special chars (euro-sign) and umlauts in Seaside

Philippe Marschall
In reply to this post by Adrian Schmitt
2006/11/19, Adrian Schmitt <[hidden email]>:
> 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
specific).

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
this.

Philippe

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside