Problems with charset="utf-8"

Asked

Viewed 298 times

0

I have a die with light recorded on the bank postgres with UTF-8 example: Joseph

When I recover the page comes correctly, but when I give the Submit 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 on the page it 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&amp;v=6.0">
        <script type="text/javascript" src="/teste/javax.faces.resource/jquery/jquery.js.xhtml?ln=primefaces&amp;v=6.0"></script>
        <script type="text/javascript" src="/teste/javax.faces.resource/jquery/jquery-plugins.js.xhtml?ln=primefaces&amp;v=6.0"></script>
        <script type="text/javascript" src="/teste/javax.faces.resource/core.js.xhtml?ln=primefaces&amp;v=6.0"></script>
        <link type="text/css" rel="stylesheet" href="/teste/javax.faces.resource/components.css.xhtml?ln=primefaces&amp;v=6.0">
        <script type="text/javascript" src="/teste/javax.faces.resource/components.js.xhtml?ln=primefaces&amp;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>
  • Marcelo posted how he made the bank connection (remove the host, login and password before posting here). Because I think this problem is solved in connection, also put the part of FORM. This Submit is by ajax or normal form?

  • I put in Persistence.xml

  • Marcelo, if you can put the Form would also help to be sure. Thank you.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.