>From: Tomasz Pasierb <[EMAIL PROTECTED]> > > Hello, > > Could any of you guys explain how I can use the shale-clay composition > features with html tiles that are encoded in utf-8 or any other encoding > than iso-8859-1? > > From what I have found so far it seems that it's actually a problem of > jsp spec and tomcat implementation (or the fact that it strictly > implements the spec). With html templates I have no option of setting > the pageEncoding or contentType page directives (those apply to jsps). > I've got shale configured to proccess *.html and *.faces requests. > Underneath all those requests go through jasper (when deployed on > tomcat). Jasper reads the tile (html), and as it cannot find the page > directives that would make it set encoding to utf-8 it defaults to > iso-8859-1 (jsp spec) which as I've found I cannot change. As a result > the utf-8 encoded file is read as iso-8859-1 and garbage is displayed on > screen. The solution would probably be to set uft-8 as the default > encoding for jasper but that's not JSP specification compliant as Craig > McClanahan stated here: > http://mail-archives.apache.org/mod_mbox/tomcat-dev/200105.mbox/%3cPine.BSF.4.21 > > [EMAIL PROTECTED] > > > During my "investigation" I found that I could use the switch > -Dfile.encoding=utf-8 which actually makes tomcat use utf-8 encoding > internally and myfaces doesn't convert non-ascii characters to html > entities any longer but those characters are still not converted > correctly when they are read from hdd. > > I've tried filtering all requests and in my desparation ;-) I've set > both request's and response's characterEncoding to utf-8 and response's > contentType to "text/html;charset=utf-8" but it doesn't seem to work. > > I've tried the following thing on tomcat to actually check this: > I prepared a utf-8 encoded html file with non-ascii characters. I viewed > this page with standard tomcat web.xml and server.xml settings plus the > -Dfile.encoding=utf-8 option. The page was read by tomcat correctly from > disk and displayed correctly in the browser. Then I mapped the *.html > extension to jsp servlet. When I requested the page, the response had > the wrong characters in it and was not displayed correctly in the browser. > > Is there any solution to this problem? Please tell me those composition > features of shale-clay can actually be used with something else than > iso-8859-1. > > Maybe an configuration option could be introduced in shale for encoding > that would be used when shale generates jsps dynamically (the page > directive). I guess this would make the problem go away. >
The Clay full html views don't generate JSP's. They build the JSF component tree and the components invoke rendering. However, Clay is a JSF component and can be used within a JSP page. I think that would be a good test for us to help narrow down where the fault lies. I'd like you to try using clay within a JSP page. The entire page would look like the following: <[EMAIL PROTECTED] contentType="text/html;charset=UTF-8"%> <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%> <%@ taglib prefix="clay" uri="http://shale.apache.org/clay"%> <f:view> <clay:clay id="page1" jsfid="/pages/page1.html"/> </f:view> Another task would be to create a JIRA Shale issue (https://issues.apache.org/struts/secure/Dashboard.jspa) and attach the utf encoded template examples. > Regards, > Tom Pasierb Gary > > ---------------------------------------------------------------------- > Jestes kierowca? To poczytaj! >>> http://link.interia.pl/f199e >
