[Seaside] Encoding on saving html file

Johan Brichau johan at inceptive.be
Sun Oct 18 13:07:28 UTC 2015


> On 17 Oct 2015, at 22:46, Dave <lasmiste at gmail.com> wrote:
> 
> With [1] I guess you are linking to this:
> http://forum.world.st/Accent-in-generated-pages-tp4832873p4832910.html <http://forum.world.st/Accent-in-generated-pages-tp4832873p4832910.html>

Sorry, forgot to include the link :/

> I tried to change   with  and save it as you suggest, but it doesn't work,
> text contains perché

Which, as Stephan noted, is the UTF8 encoding for ‘perché’. You can test it:

(GRCodec forEncoding: 'utf8') decode: 'perché’

So, how our opening the text file? And how are you saving it to disk?
Because if you save it as bytes to a file, it will be correctly utf8 encoded.

Johan

> 
> I tried something different as Sven suggested some time ago:
> http://forum.world.st/File-upload-encoding-issue-tp4783446p4783615.html <http://forum.world.st/File-upload-encoding-issue-tp4783446p4783615.html> i.e 
> and it works, but if you can explain how to make your example working I'll
> be glad.
> 
> Thanks
> Dave
> 
> 
> 
> Johan Brichau-2 wrote
>> You might want to look at [1] for a related discussion about this issue.
>> 
>> Instead of getting the stream contents from your context and saving that,
>> try the following:
>> 
>> 	| 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 ].
>> 
>> If you really want to create a text file, how are you saving and viewing
>> that text file once you get the contents from a Seaside document?
>> 
>> Johan
>> 
>>> On 17 Oct 2015, at 16:44, Stephan Eggermont &lt;
> 
>> stephan@
> 
>> &gt; wrote:
>>> 
>>> On 17/10/15 15:46, Dave wrote:
>>>> But if you save the text of my previous email to an html file and open
>>>> it, it
>>>> shows "perché" instead of "perché"
>>> 
>>> That depends on how you save it.
>>> You probably want to use an UTF8TextConverter somewhere
>>> It is used in MultiByteBinaryOrTextStream class>>on:encoding:
>>> 
>>> Stephan
>>> 
>>> 
>>> _______________________________________________
>>> seaside mailing list
>>> 
> 
>> seaside at .squeakfoundation
> 
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside <http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside>
>> 
>> _______________________________________________
>> seaside mailing list
> 
>> seaside at .squeakfoundation
> 
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside <http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside>
> 
> 
> Johan Brichau-2 wrote
>> You might want to look at [1] for a related discussion about this issue.
>> 
>> Instead of getting the stream contents from your context and saving that,
>> try the following:
>> 
>> 	| 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 ].
>> 
>> If you really want to create a text file, how are you saving and viewing
>> that text file once you get the contents from a Seaside document?
>> 
>> Johan
>> 
>>> On 17 Oct 2015, at 16:44, Stephan Eggermont &lt;
> 
>> stephan@
> 
>> &gt; wrote:
>>> 
>>> On 17/10/15 15:46, Dave wrote:
>>>> But if you save the text of my previous email to an html file and open
>>>> it, it
>>>> shows "perché" instead of "perché"
>>> 
>>> That depends on how you save it.
>>> You probably want to use an UTF8TextConverter somewhere
>>> It is used in MultiByteBinaryOrTextStream class>>on:encoding:
>>> 
>>> Stephan
>>> 
>>> 
>>> _______________________________________________
>>> seaside mailing list
>>> 
> 
>> seaside at .squeakfoundation
> 
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside <http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside>
>> 
>> _______________________________________________
>> seaside mailing list
> 
>> seaside at .squeakfoundation
> 
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside <http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside>
> 
> 
> 
> 
> 
> --
> View this message in context: http://forum.world.st/Encoding-on-saving-html-file-tp4856116p4856230.html <http://forum.world.st/Encoding-on-saving-html-file-tp4856116p4856230.html>
> Sent from the Seaside General mailing list archive at Nabble.com <http://nabble.com/>.
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org <mailto:seaside at lists.squeakfoundation.org>
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside <http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20151018/c8938bae/attachment-0003.htm


More information about the seaside mailing list