Thursday, October 2, 2003, 7:47:12 AM, mailmur wrote:

> Would it be possible to specify an outputencoding
> directive at the start of velocity template? I believe
> FreeMarker can do it, but not sure about it.

It can't (out-of-the-box), since it uses a Writer to write the output,
so it does not deal with output encoding.

> I can see it's a bit problem to control outputstream
> within the template as its too late for such
> properties.

If the Writer buffers the characters, it is possible to change the
encoding until the Writer is not flushed, since the encoding will be
needed only when the Writer flushes its buffer into the underlaying
OutputStreamWriter. However, in the case of servlers, it has the problem
that you get a readily made Writer with resp.getWriter, so you can't
control there things, and using new MyCustomWriter(res.getOutputStream)
has catches...

But anyway, I think that controlling output encoding in template is
usually not a good practice. And, I tend to think that the safest is if
you just use UTF-8 as output encoding everywhere... no "?"-s.

> Resourceloader maybe should check it in
> advance and store template's directives for later use.

Maybe introducing general purpose template attributes that can be
queried before actually executing (merge) the template...

#attribute("outputEncoding", "ISO-8859-5")
#attribute("cache", "30m")
...

So you can assign *any* name-value pairs to templates.

[snip]

-- 
Best regards,
 Daniel Dekany



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to