On 9 January 2012 11:36, Thorsten Scherler <scher...@gmail.com> wrote:
> On Mon, 2012-01-09 at 08:32 +0100, Robby Pelssers wrote:
>> Hi Thorsten,
>>
>> Adding <meta> in general is not a concern faik but setting the correct 
>> encoding is.
>>
>> Examples are
>> <?xml version="1.0" encoding="UTF-8"?>  for xml files
>
> That is correct for the doc declaration.
>
>> And
>> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> for 
>> html files
>
> nupp, that tag may be needed to be valid html5 but that is not the
> concern of the serializer but the prior transformation process.
>
>>
>> So I was only referring to setting the correct encoding which can be 
>> configured as a Serializer property.
>
> Yes but that only goes in the PI and is used for the serialization.

Not really convinced, chiefly for reasons of separation of concerns.
Given that throughout the pipeline the XML is being held in java's
unicode strings, IMO the only component that should need to worry
about the charset being used to serialise the output should be the
serialiser that's doing it, otherwise you can end up with a document
using one charset that claims inside to be a different one.
If you're happy to leave it to the serialiser to insert the PI in the
output (including the charset) rather than having it already in the
pipeline's XML stream (e.g. inserted by xsl:processing-instruction in
an XSLT template), and happy to let the the HTML serialiser insert the
doctype rather than having it already in the pipeline's stream, then
why shouldn't the HTML/XHTML serialiser also insert the meta tag
specifying the charset?

In an ideal world, we wouldn't even have to specify a particular
encoding on the serialiser either - there'd be a default configured
somewhere, but it would select an appropriate one dynamically at the
time of output based on the Accept-Charset request header sent by the
browser... and why should the earlier part of the pipeline also need
to worry about that?


Andy.

>
> salu2
>
>>
>> Robby
>>
>>
>> -----Original Message-----
>> From: Thorsten Scherler [mailto:scher...@gmail.com]
>> Sent: Sunday, January 08, 2012 10:28 PM
>> To: dev@cocoon.apache.org
>> Subject: RE: HTML5 serializer
>>
>> On Fri, 2012-01-06 at 19:56 +0100, Robby Pelssers wrote:
>> > ....
>>
>> > So we’re almost there.   Do you have any suggestion how to accomplish
>> > using the correct <meta charset=”utf-8”/>  ??  Or do you think that’s
>> > not worth the effort?
>>
>> Hmm, actually that is not the concern of the serializer at all. The
>> serializer merely adds DOCTYPE PI and not much more. So <meta> is
>> nothing the serializer should add.
>>
>> salu2
>>
>
> --
> Thorsten Scherler <thorsten.at.apache.org>
> codeBusters S.L. - web based systems
> <consulting, training and solutions>
> http://www.codebusters.es/

Reply via email to