I have a data with aced recorded in the postgres database with UTF-8 example: Jose
When I retrieve the page comes correctly, but when I submit the submit it changes to: Josà © .
My JSF header looks like this:
<h:head>
<f:facet name="first">
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
</f:facet>
<title><ui:insert name="tituloPagina">teste</ui:insert></title>
<h:outputStylesheet library="lib" name="styles/custom.css" />
<h:outputStylesheet library="lib" name="styles/layout.css" />
<h:outputStylesheet library="lib" name="styles/components.css" />
<h:outputScript target="body" library="primefaces"
name="jquery/jquery.js" />
<h:outputScript target="body" library="lib"
name="javascripts/app.js" />
</h:head>
And the page looks like this:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head id="j_idt4">
<head id="j_idt4">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link type="text/css" rel="stylesheet" href="/teste/javax.faces.resource/theme.css.xhtml?ln=primefaces-bootstrap">
<link type="text/css" rel="stylesheet" href="/teste/javax.faces.resource/fa/font-awesome.css.xhtml?ln=primefaces&v=6.0">
<script type="text/javascript" src="/teste/javax.faces.resource/jquery/jquery.js.xhtml?ln=primefaces&v=6.0"></script>
<script type="text/javascript" src="/teste/javax.faces.resource/jquery/jquery-plugins.js.xhtml?ln=primefaces&v=6.0"></script>
<script type="text/javascript" src="/teste/javax.faces.resource/core.js.xhtml?ln=primefaces&v=6.0"></script>
<link type="text/css" rel="stylesheet" href="/teste/javax.faces.resource/components.css.xhtml?ln=primefaces&v=6.0">
<script type="text/javascript" src="/teste/javax.faces.resource/components.js.xhtml?ln=primefaces&v=6.0"></script>
<link type="text/css" rel="stylesheet" href="/teste/javax.faces.resource/styles/custom.css.xhtml?ln=lib">
<link type="text/css" rel="stylesheet" href="/teste/javax.faces.resource/styles/layout.css.xhtml?ln=lib">
<link type="text/css" rel="stylesheet" href="/teste/javax.faces.resource/styles/components.css.xhtml?ln=lib">
<script type="text/javascript" src="/teste/javax.faces.resource/javascripts/app.js.xhtml?ln=lib"></script>
<script type="text/javascript" src="/teste/javax.faces.resource/javascripts/progressStep.js.xhtml?ln=lib"></script>
<script type="text/javascript" src="/teste/javax.faces.resource/javascripts/raphael.js.xhtml?ln=lib"></script>
<script type="text/javascript">if(window.PrimeFaces){PrimeFaces.settings.locale='pt_BR';PrimeFaces.settings.projectStage='Development';}</script>
<title>Teste</title>
</head>
persistence.xml
<!-- Padrao -->
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://x.x.x.x/nomeBanco" />
<property name="javax.persistence.jdbc.user" value="usuario" />
<property name="javax.persistence.jdbc.password" value="senha" />
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.connection.useUnicode" value="true" />
<property name="hibernate.connection.characterEncoding" value="UTF-8" />
<property name="use_sql_comments" value="true" />
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
<property name="hibernate.connection.pool_size" value="100" />
Form
<h:form id="frm">
<p:toolbar>
<f:facet name="left">
<p:button id="btMenuInicial" value="Menu Inicial"
icon="ui-icon-home" outcome="/Index.xhtml" styleClass="ms-botao150"/>
</f:facet>
</p:toolbar>
<h:panelGroup>
<p:messages id="msgs" showDetail="false" autoUpdate="true"
closable="true" />
<h3>Endereço</h3>
<p:panelGrid layout="grid" columns="4"
columnClasses="ui-grid-col-2,ui-grid-col-4,ui-grid-col-2,ui-grid-col-4"
styleClass="ms-panelgrid-noborder" style="margin-top:20px">
<p:outputLabel for="cpCep" value="Cep" />
<p:inputMask mask="99999-999" id="cpCep" required="false"
value="#{controller_MB.usuario.cep}">
<p:ajax update="cpEndereco cpCidade cpBairro cpUF cpNumero cpComplemento"
listener="#{controller_MB.buscaCep()}" />
</p:inputMask>
<p:outputLabel for="cpEndereco" value="Endereco" />
<p:inputText id="cpEndereco" required="false"
value="#{controller_MB.usuario.endereco}" disabled="#{controller_MB.camposCepDesabilidados}" styleClass="js-retira-acento"/>
<p:outputLabel for="cpNumero" value="Numero" />
<p:inputText id="cpNumero" value="#{controller_MB.usuario.numero}" disabled="#{controller_MB.camposCepDesabilidados}"/>
<p:outputLabel for="cpComplemento" value="Complemento" />
<p:inputText id="cpComplemento" required="false"
value="#{controller_MB.usuario.complemento}" disabled="#{controller_MB.camposCepDesabilidados}" styleClass="js-retira-acento"/>
<p:outputLabel for="cpCidade" value="Cidade" />
<p:inputText id="cpCidade" required="false"
value="#{controller_MB.usuario.cidade}" disabled="#{controller_MB.camposCepDesabilidados}" styleClass="js-retira-acento"/>
<p:outputLabel for="cpBairro" value="Bairro" />
<p:inputText id="cpBairro" required="false"
value="#{controller_MB.usuario.bairro}" disabled="#{controller_MB.camposCepDesabilidados}" styleClass="js-retira-acento"/>
<p:outputLabel for="cpUF" value="UF" />
<p:inputText id="cpUF" required="false"
value="#{controller_MB.usuario.uf}" disabled="#{controller_MB.camposCepDesabilidados}"/>
</p:panelGrid>
<p:button id="btConsulta" value="Cancela" outcome="/Index.xhtml"
styleClass="ms-botao" />
</h:form>