Accent in generated pages

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

Accent in generated pages

abergel
Hi!

I am migrating code from Amber to Pharo, and I am facing a problem with the accent. Consider the following example:

        | fullDocument fs canvas |
        canvas := WAHtmlCanvas builder.
        canvas fullDocument: true.
        canvas rootClass: ABHtmlRoot.
        fullDocument :=  canvas render: [ :html |
                html text: 'Ñuñoa'

                 ].
        fs  := FileStream forceNewFileNamed: '/tmp/test.html'.
        fs nextPutAll: fullDocument.
        fs close.

Opening the file in a web browser shows me: Ñuñoa

Is there a way to prevent this?

Cheers,
Alexandre

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



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

Re: Accent in generated pages

Sven Van Caekenberghe-2
Alex,

Try:

'/tmp/test.html' asFileReference writeStreamDo: [ :out | out << 'Ñuñoa' ].
'/tmp/test.html' asFileReference contents.

prometheus:Smalltalk sven$ file /tmp/test.html
/tmp/test.html: UTF-8 Unicode text, with no line terminators
prometheus:Smalltalk sven$ cat /tmp/test.html
Ñuñoa

The streams created above do the proper (utf-8) encoding, the ones in your example do not.

HTH,

Sven

> On 17 Jun 2015, at 21:05, Alexandre Bergel <[hidden email]> wrote:
>
> Hi!
>
> I am migrating code from Amber to Pharo, and I am facing a problem with the accent. Consider the following example:
>
> | fullDocument fs canvas |
> canvas := WAHtmlCanvas builder.
> canvas fullDocument: true.
> canvas rootClass: ABHtmlRoot.
> fullDocument :=  canvas render: [ :html |
> html text: 'Ñuñoa'
>
> ].
> fs  := FileStream forceNewFileNamed: '/tmp/test.html'.
> fs nextPutAll: fullDocument.
> fs close.
>
> Opening the file in a web browser shows me: Ñuñoa
>
> Is there a way to prevent this?
>
> Cheers,
> Alexandre
>
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
> _______________________________________________
> 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: Accent in generated pages

abergel
Thanks!
But the problem remains I fear.

        | fullDocument canvas |
        canvas := WAHtmlCanvas builder.
        canvas fullDocument: true.
        canvas rootClass: ABHtmlRoot.
        fullDocument :=  canvas render: [ :html |
                html text: 'Ñuñoa'

                 ].
         '/tmp/test.html' asFileReference writeStreamDo: [ :out | out << fullDocument ].
       
Opening test.html gave me: Ñuñoa

I guess I should generate the html code for the accentued characters. But I guess there is something already in Seaside right?

Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



> On Jun 17, 2015, at 5:10 PM, Sven Van Caekenberghe <[hidden email]> wrote:
>
> Alex,
>
> Try:
>
> '/tmp/test.html' asFileReference writeStreamDo: [ :out | out << 'Ñuñoa' ].
> '/tmp/test.html' asFileReference contents.
>
> prometheus:Smalltalk sven$ file /tmp/test.html
> /tmp/test.html: UTF-8 Unicode text, with no line terminators
> prometheus:Smalltalk sven$ cat /tmp/test.html
> Ñuñoa
>
> The streams created above do the proper (utf-8) encoding, the ones in your example do not.
>
> HTH,
>
> Sven
>
>> On 17 Jun 2015, at 21:05, Alexandre Bergel <[hidden email]> wrote:
>>
>> Hi!
>>
>> I am migrating code from Amber to Pharo, and I am facing a problem with the accent. Consider the following example:
>>
>> | fullDocument fs canvas |
>> canvas := WAHtmlCanvas builder.
>> canvas fullDocument: true.
>> canvas rootClass: ABHtmlRoot.
>> fullDocument :=  canvas render: [ :html |
>> html text: 'Ñuñoa'
>>
>> ].
>> fs  := FileStream forceNewFileNamed: '/tmp/test.html'.
>> fs nextPutAll: fullDocument.
>> fs close.
>>
>> Opening the file in a web browser shows me: Ñuñoa
>>
>> Is there a way to prevent this?
>>
>> Cheers,
>> Alexandre
>>
>> --
>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>> Alexandre Bergel  http://www.bergel.eu
>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>
>>
>>
>> _______________________________________________
>> 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

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

Re: Accent in generated pages

Sven Van Caekenberghe-2
Hmm, this works for me:

'/tmp/test.html' asFileReference writeStreamDo: [ :out |
  out << (WAHtmlCanvas builder fullDocument: true; render: [ :html | html text: 'Ñuñoa' ]) ].

$ 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

You could also do

  WAHtmlCanvas builder fullDocument: true; codec: (GRCodec forEncoding: #utf8); render: [ :html | html text: 'Ñuñoa' ].

But that makes no difference in this case.

What does ABHtmlRoot do ? Maybe it customises something ?

> On 17 Jun 2015, at 22:18, Alexandre Bergel <[hidden email]> wrote:
>
> Thanks!
> But the problem remains I fear.
>
> | fullDocument canvas |
> canvas := WAHtmlCanvas builder.
> canvas fullDocument: true.
> canvas rootClass: ABHtmlRoot.
> fullDocument :=  canvas render: [ :html |
> html text: 'Ñuñoa'
>
> ].
> '/tmp/test.html' asFileReference writeStreamDo: [ :out | out << fullDocument ].
>
> Opening test.html gave me: Ñuñoa
>
> I guess I should generate the html code for the accentued characters. But I guess there is something already in Seaside right?
>
> Alexandre
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>> On Jun 17, 2015, at 5:10 PM, Sven Van Caekenberghe <[hidden email]> wrote:
>>
>> Alex,
>>
>> Try:
>>
>> '/tmp/test.html' asFileReference writeStreamDo: [ :out | out << 'Ñuñoa' ].
>> '/tmp/test.html' asFileReference contents.
>>
>> prometheus:Smalltalk sven$ file /tmp/test.html
>> /tmp/test.html: UTF-8 Unicode text, with no line terminators
>> prometheus:Smalltalk sven$ cat /tmp/test.html
>> Ñuñoa
>>
>> The streams created above do the proper (utf-8) encoding, the ones in your example do not.
>>
>> HTH,
>>
>> Sven
>>
>>> On 17 Jun 2015, at 21:05, Alexandre Bergel <[hidden email]> wrote:
>>>
>>> Hi!
>>>
>>> I am migrating code from Amber to Pharo, and I am facing a problem with the accent. Consider the following example:
>>>
>>> | fullDocument fs canvas |
>>> canvas := WAHtmlCanvas builder.
>>> canvas fullDocument: true.
>>> canvas rootClass: ABHtmlRoot.
>>> fullDocument :=  canvas render: [ :html |
>>> html text: 'Ñuñoa'
>>>
>>> ].
>>> fs  := FileStream forceNewFileNamed: '/tmp/test.html'.
>>> fs nextPutAll: fullDocument.
>>> fs close.
>>>
>>> Opening the file in a web browser shows me: Ñuñoa
>>>
>>> Is there a way to prevent this?
>>>
>>> Cheers,
>>> Alexandre
>>>
>>> --
>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>> Alexandre Bergel  http://www.bergel.eu
>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>
>>>
>>>
>>> _______________________________________________
>>> 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
>
> _______________________________________________
> 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: Accent in generated pages

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

Alexandre

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

Re: Accent in generated pages

Sven Van Caekenberghe-2

> On 17 Jun 2015, at 22:48, Alexandre Bergel <[hidden email]> 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
> [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: Accent in generated pages

abergel
Ah okay!

Last quick question (I hope :-)

How to automatically add this "<?xml version="1.0" encoding="UTF-8”?>” in front of the generated file? Should I use a new WAHtmlRoot? Or an WAHtmlAttributes? Or plugging somewhere an WAEncoder?

Thanks Sven, this is really helpful!

Cheers,
Alexandre
-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



On Jun 17, 2015, at 5:59 PM, Sven Van Caekenberghe <[hidden email]> wrote:


On 17 Jun 2015, at 22:48, Alexandre Bergel <[hidden email]> 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
[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


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

Re: Accent in generated pages

Sven Van Caekenberghe-2

> On 17 Jun 2015, at 23:29, Alexandre Bergel <[hidden email]> wrote:
>
> Ah okay!
>
> Last quick question (I hope :-)
>
> How to automatically add this "<?xml version="1.0" encoding="UTF-8”?>” in front of the generated file? Should I use a new WAHtmlRoot? Or an WAHtmlAttributes? Or plugging somewhere an WAEncoder?

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

Maybe someone else can answer ...

> Thanks Sven, this is really helpful!
>
> Cheers,
> Alexandre
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>> On Jun 17, 2015, at 5:59 PM, Sven Van Caekenberghe <[hidden email]> wrote:
>>
>>>
>>> On 17 Jun 2015, at 22:48, Alexandre Bergel <[hidden email]> 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
>>> [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
>
> _______________________________________________
> 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: Accent in generated pages

abergel
Thanks Sven! You fixed my problem already!

Cheers,
Alexandre
-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



On Jun 17, 2015, at 6:52 PM, Sven Van Caekenberghe <[hidden email]> wrote:


On 17 Jun 2015, at 23:29, Alexandre Bergel <[hidden email]> wrote:

Ah okay!

Last quick question (I hope :-)

How to automatically add this "<?xml version="1.0" encoding="UTF-8”?>” in front of the generated file? Should I use a new WAHtmlRoot? Or an WAHtmlAttributes? Or plugging somewhere an WAEncoder?

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

Maybe someone else can answer ...

Thanks Sven, this is really helpful!

Cheers,
Alexandre
-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



On Jun 17, 2015, at 5:59 PM, Sven Van Caekenberghe <[hidden email]> wrote:


On 17 Jun 2015, at 22:48, Alexandre Bergel <[hidden email]> 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
[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

_______________________________________________
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


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

Re: Accent in generated pages

Johan Brichau-2
In reply to this post by Sven Van Caekenberghe-2

On 17 Jun 2015, at 23:52, Sven Van Caekenberghe <[hidden email]> wrote:

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

It doesn’t work because this is not exactly using Seaside. 
It’s using the Seaside canvas, and that’s it.

As you said, the browser does not get any mimetype and it seems Safari doesn’t take utf-8 as the default..

When you use the WABuilder, there’s the #rootBlock: method to render the root part of the document, where it seems one can pass the encoding to be used by the browser.
Try this:

| fullDocument |
fullDocument := WAHtmlCanvas builder 
fullDocument: true;
rootBlock: [:root | root meta contentType: (WAMimeType textHtml charset:'utf-8') ];
render: [ :html | html text: 'Ñuñoa' ].
 
'/tmp/test.html' asFileReference writeStreamDo: [ :out | out << fullDocument ].

cheers
Johan

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

Re: Accent in generated pages

abergel
Thanks Johan & Sven!

Works perfectly!

Cheers,
Alexandre


> On Jun 17, 2015, at 7:00 PM, Johan Brichau <[hidden email]> wrote:
>
>
>> On 17 Jun 2015, at 23:52, Sven Van Caekenberghe <[hidden email]> wrote:
>>
>> I am sorry, like I said: 'I just don't know why it does not work in Seaside, normally special characters should just work, no need to do anything special.'
>
> It doesn’t work because this is not exactly using Seaside.
> It’s using the Seaside canvas, and that’s it.
>
> As you said, the browser does not get any mimetype and it seems Safari doesn’t take utf-8 as the default..
>
> When you use the WABuilder, there’s the #rootBlock: method to render the root part of the document, where it seems one can pass the encoding to be used by the browser.
> Try this:
>
> | fullDocument |
> fullDocument := WAHtmlCanvas builder
> fullDocument: true;
> rootBlock: [:root | root meta contentType: (WAMimeType textHtml charset:'utf-8') ];
> render: [ :html | html text: 'Ñuñoa' ].
>
> '/tmp/test.html' asFileReference writeStreamDo: [ :out | out << fullDocument ].
>
> cheers
> Johan
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



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