-
1. Re: Encodingproblem with rich:comboBox
fmarwede Feb 14, 2009 5:57 AM (in response to rschoeler)Hi rschoeler!
Look at these three issues and how they are related:
- https://jira.jboss.org/jira/browse/RF-4985
- https://jira.jboss.org/jira/browse/RF-5639
- https://jira.jboss.org/jira/browse/RF-5964
And finally the link to a myfaces problem:
https://issues.apache.org/jira/browse/MYFACES-2126
It would be helpful if you could test, if your bug is already there without using myfaces. -
2. Re: Encodingproblem with rich:comboBox
rschoeler Feb 14, 2009 7:41 AM (in response to rschoeler)Hi fmarwede, thank you for pointing me to the issues!
Naturally I've tried to switch from MyFace to Sun RI and for this problem - Encoding with rich:comboBox - I can verify that using Sun RI (mojarra-1.2_12-binary) solve this problem.......but other problems - no AJAX-Functionality works anymore - occured. 8-{
I will do a little research and try some things, because it's the first time I use Sun RI. Maybe I need some setting or so - although the pdf-documentation sounds, that no explicit setting is necessary.
wfg
roland -
3. Re: Encodingproblem with rich:comboBox
fmarwede Feb 14, 2009 7:52 AM (in response to rschoeler)Hi Roland,
in my experience you need (when you switch from MyFaces to Sun) (a) another combination of supporting jars (i mean this apache common stuff and so on) and (b) another configuration of the web.xml.
Are you sure, that you considered both aspects sufficiently? -
4. Re: Encodingproblem with rich:comboBox
nbelaevski Feb 14, 2009 10:02 AM (in response to rschoeler)"rschoeler" wrote:
Hi fmarwede, thank you for pointing me to the issues!
Naturally I've tried to switch from MyFace to Sun RI and for this problem - Encoding with rich:comboBox - I can verify that using Sun RI (mojarra-1.2_12-binary) solve this problem.......but other problems - no AJAX-Functionality works anymore - occured. 8-{
I will do a little research and try some things, because it's the first time I use Sun RI. Maybe I need some setting or so - although the pdf-documentation sounds, that no explicit setting is necessary.
wfg
roland
Hi Roland,
I've just tried to run richfaces-demo using 1.2_12 JSF. Quick check ok. Can you please clarify what components don't work and what issue do you experience? -
5. Re: Encodingproblem with rich:comboBox
rschoeler Feb 14, 2009 10:09 AM (in response to rschoeler)Hi farmwede&nbelaevski, thanks for your help. I've found the soure of my AJAX-Problem....forgot to remove parameter "org.ajax4jsf.xmlparser.ORDER" from my web.xml....was an artifact from some earlier tries.
After removing this param - everything works fine with Sun RI.
Switching between this two implementations is really easy....8-}
Now I've found a solution for this problem which works for both Implementations. Cost me some time - but it works now!
Maybe this solution will also works for other problems regarding encoding stuff - can someone forward this information to RF docu team &
1. Using Sun RI (mojarra-1.2_12-binary)
=> nothing to do, because Umlaute are presented like they are!
2. Using Apache MyFace (v. 1.2.5)
=> using an own filter, which ensures correct used encoding (see code above)
=> don't forget Encoding in HEADER-Tag
=> also update web.xml with filter-class
Source for my Solution according Apache MyFace/Tomcat:
http://wiki.apache.org/tomcat/Tomcat/UTF-8
My own filter (very similar to the one from the URL above):import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; public class CharsetFilter implements Filter { private String encoding; public void init(FilterConfig config) throws ServletException { // TODO Auto-generated method stub encoding = config.getInitParameter("encoding"); if (encoding == null) encoding = "UTF-8"; } public void doFilter(ServletRequest request, ServletResponse response, FilterChain next) throws IOException, ServletException { // TODO Auto-generated method stub request.setCharacterEncoding(encoding); response.setCharacterEncoding(encoding); next.doFilter(request, response); } public void destroy() {} }
wfg
roland -
6. Re: Encodingproblem with rich:comboBox
nbelaevski Feb 16, 2009 5:11 AM (in response to rschoeler)Hello,
Why not set encoding at page level? It should work without filter. -
7. Re: Encodingproblem with rich:comboBox
rschoeler Feb 16, 2009 5:30 AM (in response to rschoeler)Hello, naturally encoding is set at page level with META-Tag and contentType etc., but the problem with rich:comboBox isn't affected by this setting.
That was the problem. Everything else works fine with encoding on this page - except the rich:comboBox. Problem is reproduceable.
No problem with rich:comboBox if using Sun RI.
But problem exists, if using current release of Apache MyFaces - one solution for this, which works successfully: Filter, as described in posting
I don't know, why the page encoding doesn't work correctly - I only know that this is the case.
regards
roland -
8. Re: Encodingproblem with rich:comboBox
nbelaevski Feb 16, 2009 9:49 AM (in response to rschoeler)Do you use Facelets or JSP?
-
9. Re: Encodingproblem with rich:comboBox
rschoeler Feb 16, 2009 10:40 AM (in response to rschoeler)Hi, only JSP - facelets will be done in a later stage, because I wasn't able to introduce them correctly in the short time I've had.
-
10. Re: Encodingproblem with rich:comboBox
nbelaevski Feb 16, 2009 1:29 PM (in response to rschoeler)Try setting encoding using page directive:
<jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
-
11. Re: Encodingproblem with rich:comboBox
rschoeler Feb 16, 2009 3:33 PM (in response to rschoeler)Hi Nick, thanks for your answer, but I was to fast and wrong with my answer.....this is my first project with JSF and it's some kind of evolutionary prototyp (although for professional work) - therefore it could contains a lot of mixing technologies/programming style etc......8-}
This is the start of my HTML-page - but every page looks very similar to this.<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %> <%@ taglib uri="http://richfaces.org/rich" prefix="rich" %> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> <f:view locale="#{facesContext.externalContext.request.locale}"> <f:loadBundle basename="messages" var="msgs"/> <!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"> <head> <link type="text/css" href="./css/workplace.css" rel="stylesheet" media="screen"> <title><h:outputText value="#{msgs.article_title}"/></title> <link rel="shortcut icon" href="./images/favicon.ico" type="image/x-icon"> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/> </head> <body>....
-
12. Re: Encodingproblem with rich:comboBox
nbelaevski Feb 16, 2009 5:56 PM (in response to rschoeler)Ok, here is the snippet for plain JSP pages:
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
For Facelets:<?xml version="1.0" encoding="UTF-8" ?>
The reason for all this stuff is that response writer doesn't handle META tags, but uses request.getCharacterEncoding() to calculate encoding. -
13. Re: Encodingproblem with rich:comboBox
rschoeler Feb 17, 2009 4:01 PM (in response to rschoeler)Hi Nikolay, I've tried your snippet for plain JSP pages, cleaned the cache, removed my Charset-filter etc. - thanks for your explanation for the reason.
Problem already there - it's a little bit enlighted, but still existing....8-{
Following behaviour:
1. Open page first time:
=> rich:comboBox doesn't show the correct spelling - if special characters are inside of the suggestionlist
=> rest of the page has correct spelling
2. Select one item of the rich:comboBox
=> if the selected item is one of the misspelled one - the display is also mispelled, but the new constructed suggestionlist is correct spelled
=> if the selected item is not misspelled - the displayed selection is correct spelled, and the new constructed suggestionlist too
=> once the suggestionlist is correct displayed - the bug never appears, if you don't leave the page....
3. Move away and come back
=> same behaviour as in point 1
With help of this page http://www.utf8-chartable.de/unicode-utf8-table.pl?unicodeinhtml=dec&htmlent=1 I found out that the representation in the rich:comboBox is numerical HTML encoding of the Unicode character with decimal
Now I know, that I must use my workaround with the charset-Filter until a new release of Apache MyFaces (or RichFace?) solve this problem......because I don't know, who is really responsible for this bug...;-}
regards
roland