[Seaside] Accent in generated pages

Sven Van Caekenberghe sven at stfx.eu
Wed Jun 17 20:59:40 UTC 2015


> On 17 Jun 2015, at 22:48, Alexandre Bergel <alexandre.bergel at me.com> wrote:
> 
>> $ cat /tmp/test.html 
>> <html><head><title></title></head><body onload="onLoad()">Ñuñoa<script type="text/javascript">/*<![CDATA[*/function onLoad(){};/*]]>*/</script></body></html>
>> 
>> $ file /tmp/test.html 
>> /tmp/test.html: HTML document text
> 
> Okay, but I am opening test.html within Safari, then accents are not shown.
> You pointed me on these codec, but I see none related to string accent conversion.
> 
> I have seen the class WAUrlEncoder, but this is for URL. 
> | w |
> w := WriteStream on: String new.
> 'Ñuñoa' do: [ :c |
> 	WAUrlEncoder encode:  c on: w ].
> w contents
> 
> =>  '%D1u%F1oa’
> 
> I need something like that but for html code.
> 
> I tried also
> 'Ñuñoa'  encodeOn:   WAXmlDocument new
> But no, I do not get something that starts with: '&Ntilde;u…'
> 
> Any idea?

Yes, I just don't know why it does not work in Seaside, normally special characters should just work, no need to do anything special.

What needs to be added is 

<?xml version="1.0" encoding="UTF-8"?>

in front of the .html, like:

$ cat /tmp/test.html 
<?xml version="1.0" encoding="UTF-8"?><html><head><title></title></head><body onload="onLoad()">Ñuñoa<script type="text/javascript">/*<![CDATA[*/function onLoad(){};/*]]>*/</script></body></html>

When opening an HTML file locally, there is no mime-type added by the server, hence the browser does not know the encoding.

Here is another live example (independent of Seaside):

http://zn.stfx.eu/unicode

> Alexandre
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



More information about the seaside mailing list