UTF8 issues in postgres

0

I have a JSF project with JPA, Postgres 9 bank The information with acendo is being recorded with problems in the accent.

   Shark records as Shark

The Bank is with:

  

Ecoding = UTF8
  Collation = English_Brazil, 1252
  Character Type = Portuguese_Brazil, 1252

All xhttp pages with:

<h:head>
   <f:facet name="first">
       <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
       <meta name="viewport" content="width=device-width, initial-scale=1"/>
   </f:facet>
   ... 

Note:
If I record directly to the bank, it writes correctly and it comes correct to page, but when I revoke the problem.

The reverse also happens, I type correctly on the page but when I burn write with problem.

    
asked by anonymous 17.08.2016 / 19:03

2 answers

1

Assuming that the encoding of your DATABASE and your server is using UTF8 as ENCODING , I suggest checking your client.

PostgreSQL has an environment variable called CLIENT_ENCODING that is responsible for controlling the encoding used by the client that is connected to the database server.

With this variable set up properly, the server is able to convert the client / server and server / client encodings appropriately, otherwise the reported case will happen.

With the command SHOW , we can examine how this variable is configured:

SHOW CLIENT_ENCODING;

With the command SET , we can change its value, for example:

SET CLIENT_ENCODING = 'UTF8';

Warning: Since the data has been written with this type of error, it is practically impossible to correct them orthodox.

References:

Portuguese (v8.0): link

English (v9.2): link

I hope I have helped!

    
18.08.2016 / 15:40
0

In the glassfish-web.xml file in the WEB-INF folder add:

<glassfish-web-app error-url="">
    <parameter-encoding default-charset="UTF-8"/>
    ...
</glassfish-web-app>
    
21.08.2016 / 18:52