[Seaside] Accent in generated pages
Sven Van Caekenberghe
sven at stfx.eu
Wed Jun 17 20:34:43 UTC 2015
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 <alexandre.bergel at me.com> 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 <sven at stfx.eu> 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 <alexandre.bergel at me.com> 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
>>> seaside at lists.squeakfoundation.org
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>> _______________________________________________
>> seaside mailing list
>> seaside at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
More information about the seaside
mailing list