-
1. Re: How to change characterEncoding?
rajshake Aug 26, 2008 7:40 PM (in response to rajshake)bump.
-
2. Re: How to change characterEncoding?
sergeysmirnov Aug 26, 2008 8:55 PM (in response to rajshake)utf-8 is required by client site library is used to parse XML. So, no way to change.
-
3. Re: How to change characterEncoding?
rajshake Aug 27, 2008 6:05 PM (in response to rajshake)I have to use iso-8859-1 encoding, I cannot move to utf-8 until our database server's charset is changed.
With iso-8859-1 encoding, we have been successful in allowing users to enter Non-ASCII characters through browser and save it in the database.
Now the real issue is, let's say I have a inputText, where I enter a Euro symbol €. If I have a h:selectBooleanCheckbox, and add a4j support so it reRenders the text box, the Euro symbol looks messed.
Here is a very simple usecase of what I am taling about: Looking through "LiveHttpHeaders", I notice that the contentType is set to "utf-8" in the response, as soon as I clicked on the checkbox (Ajax Request). And I am "guessing" that the Euro character getting distorted is becaused of this.
Is there any way of avoiding or working around this issue?
<!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:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:t="http://myfaces.apache.org/tomahawk"
xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
xmlns:rich="http://richfaces.ajax4jsf.org/rich"
>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<f:view>
<h:form id="mainForm">
<h:outputText value="Enter char: " />
<h:inputText id="inpText" styleClass="formtextbx" value="#{charsetBean.foo}" />
<h:outputText id="fooText" value="#{charsetBean.foo}" />
<h:selectBooleanCheckbox id="courtesyCase" value="#{charsetBean.courtesyCase}" style="vertical-align: bottom">
<a4j:support event="onclick" reRender="inpText" />
</h:selectBooleanCheckbox>
<a4j:commandLink action="#{charsetBean.testAction}" value="a4j:commandLink" reRender="inpText, fooText">
</a4j:commandLink>
</h:form>
</f:view>
Backing Bean:
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
@Scope(ScopeType.SESSION)
@Name("charsetBean")
public class CharsetBean extends BaseBean implements java.io.Serializable{
public String foo;
public boolean courtesyCase = false;
public boolean isCourtesyCase() {
return courtesyCase;
}
public void setCourtesyCase(boolean courtesyCase) {
this.courtesyCase = courtesyCase;
}
public String getFoo() {
return foo;
}
public void setFoo(String foo) {
this.foo = foo;
}
public void testAction(){
System.out.println("foo: " + foo);
}
} -
4. Re: How to change characterEncoding?
rajshake Aug 28, 2008 1:54 PM (in response to rajshake)
Any suggestions, anyone? Sergey?