On 9/24/06, Gary VanMatre <[EMAIL PROTECTED]> wrote:
[snip] > Does clay use request's characterEncoding when loading those files? This > way one could set the request's characterEncoding in a filter and then > clay would use this when loading those files. As for now setting utf-8 > encoding for the request object in a filter doesn't work (the characters > do not display correct). No, it loads the file as an InputStream and then writes it to a StringBuffer. This might be the problem area. You can find the code in the loadTemplate method here: http://svn.apache.org/viewvc/shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/ClayTemplateParser.java?view=markup
This will definitely cause the problem observed here. Treating the input as a byte stream effectively means it expects ASCII 7 bit encoding in the template files. For templates that are in XML syntax, we could deal with this by using an XML parse to read the input, which will automtically obey any encoding declaration specified inside the file. For non-XML templates, it's probably best to declare a default encoding like UTF-8 (perhaps with an override via context init parameter) to cover localized cases. You'll need to use a Reader instead of an input stream for this. Craig
