title: Wrong encoding between Spring and PostgreSQL
body: <p>I have a Spring Boot (version 1.3) Web application, all in UTF-8, and a PostgreSQL server with server encoding UTF-8 and client encoding WIN1252.</p>
  
  <p>The problem is that when I save in the DB something with special characters manually, the encoding is right, but from JDBC the string is saved wrong.</p>
  
  <p>In the same way, when I have a string saved with special characters and I make a SELECT query to read manually, the encoding is right, but from JDBC the string is read wrongly.</p>
  
  <p>Dropping the database and creating again is not a choice for the moment, so I have been trying a lot of things with poor result. Is there any solution for me?</p>
  
  <p>PD: I have put all these properties in my application.properties file:</p>
  
  <pre><code>spring.datasource.sql-script-encoding = UTF-8
  spring.http.encoding.charset = UTF-8
  spring.http.encoding.enabled = true
  spring.http.encoding.force = true
  spring.mandatory-file-encoding = UTF-8
  server.tomcat.uri-encoding = UTF-8
  spring.messages.encoding = UTF-8
  </code></pre>