-
1. Re: problem with encoding
jazir1979 May 22, 2007 1:46 AM (in response to nevermoreagain)There's a few layers this can fail at. You are right that you need the character encoding filter.
Do you know if the data is being stored/inserted correctly at the DB level? (ie- connect to MySQL using some other tool to see). MySQL allows you to specify the character encoding at a DB-wide level or on a per-table level.
When I create tables manually I always specify "DEFAULT CHARACTER SET UTF8;" explicitly, in the name of paranoia, but you can also use "default-character-set=utf8" in the my.ini config file. This is handy if seam-gen is generating your schema for you, which I guess is probably the case.
If everything is OK at the DB level, then I'm not sure.. -
2. Re: problem with encoding
nevermoreagain May 22, 2007 2:43 AM (in response to nevermoreagain)Well, i guess the problem is that pages generated as facelets(xhtml)..
-
3. Re: problem with encoding
nevermoreagain May 22, 2007 4:33 AM (in response to nevermoreagain)To set charset/encoding in JSP we can use
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
so i'm wondering is there anything like this to use in facelets -
4. Re: problem with encoding
javabr May 22, 2007 10:15 PM (in response to nevermoreagain)<f:view contentType="text/html" >
...
...
</f:view>
? -
5. Re: problem with encoding
jazir1979 May 22, 2007 10:33 PM (in response to nevermoreagain)My root facelets template just has the direct meta HTML tag in it:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
The Seam blog example uses an f:view in its template.xhtml but specifies the encoding in a direct meta tag. I didn't even think f:view had such a parameter?
I don't even use f:view, as I never saw it in the facelets developer documentation: https://facelets.dev.java.net/nonav/docs/dev/docbook.html#gettingstarted-view-template -
6. Re: problem with encoding
javabr May 22, 2007 11:00 PM (in response to nevermoreagain)yeahh
These is one of those things you learn because someone told you sometime :)
I saw this because I have just migrate my code to seam-cvs and Jboss 4.2. There, the default is contentType=xml/xhtml which turned all my javascipts as illegal things .. weird huhhhh ?
So, I got this tip on this forum in the "seam cvs examples on jboss 4.2"... I could not find any reference to it... and do not worry about seam doc.. this is from jsf implementation. -
7. Re: problem with encoding
javabr May 22, 2007 11:03 PM (in response to nevermoreagain)and my javascripts was not working w/ just this:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
...
for sure.. they just start working again when I added contentType on f:view
take a look bellow. This working for me.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:ui2="http://www.sun.com/web/ui" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:trh="http://myfaces.apache.org/trinidad/html" xmlns:tr="http://myfaces.apache.org/trinidad" xmlns:rich="http://richfaces.ajax4jsf.org/rich" xmlns:s="http://jboss.com/products/seam/taglib"> <f:view contentType="text/html"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>eTask</title> <link href="stylesheet/theme.css" rel="stylesheet" type="text/css" /> <trh:styleSheet /> <script type="text/javascript" src="/etask/theme/com/sun/rave/web/ui/defaulttheme/javascript/formElements.js" /> <script type="text/javascript" src="/etask/util.js" /> <script type="text/javascript" src="/etask/tip.js" /> </head> <body style="-rave-layout: grid"> <ui:include src="../layout/menu.xhtml" /> <ui:include src="../layout/loginout.xhtml" /> <div class="body"><f:facet name="aroundInvalidField"> <s:span styleClass="errors" /> </f:facet> <f:facet name="afterInvalidField"> <s:span> <s:message /> </s:span> </f:facet> <ui:insert name="body" /></div> <div class="footer"><a href="http://www.bittecnologia.com" target="_blank">eTask (c) Bit Technologia</a></div> </body> </f:view> </html>
-
8. Re: problem with encoding
gavin.king May 24, 2007 1:31 AM (in response to nevermoreagain)AFAIK, you need it in both the meta tag and the f:view. At least I think that's what Jacob told me. I guess Facelets uses a special UIViewRoot or something.
I'm not sure if the Seam examples have it completely correct.
You would be better off asking about this stuff in the facelets forums, and checking their FAQ.