1
I’m having a problem here and I haven’t found anything that would solve on the internet, if you could help me, I would be extremely grateful.
Well, come on, I have a java web application that uses Spring Boot + JSP. The problem is this: I have two applications that share the same database, one of them records things and the other (web) reads, so far so good, only when I record something from the other application that is Desktop, anything that has an accent, in the database is correct but Java cannot read in the Web part and exchange for a strange character.
I’ve already tried:
Create the environment variable:
JAVA_TOOL_OPTIONS
with the value =-Dfile.encoding=UTF8
Add to file
.properties
from Spring to Linespring.datasource.connectionProperties=useUnicode=true;characterEncoding=utf-8;
Change the shape of the database URL:
spring.datasource.url=jdbc:postgresql://localhost:5432/banco?useUnicode=true&characterEncoding=UTF-8
I tried to configure in POM.
I tried to create a filter.
I tried to change the direct character by the application, however, as it arrives from the bank until my application wrong already, this did not help.
Important information:
The database is configured as follows:
ENCODING = 'SQL_ASCII';
LC_COLLATE = 'C';
LC_CTYPE = 'C'.
If I record something in the web part, I can read again with the accent normally, however, in the database is something like this:
Yes, my JSP’s have the right meta tag, I can display accent normally on them. The same problem is the arrival of the database to my application. In this case, in the BD is correct but, arrives in the wrong application. Regarding the characterEncoding=UTF-8, I put to see if it solved the problem, even without it, the problem persists. So you don’t have a way to reverse this without trading directly into the bank? Why the application in Delphi (Desktop) can manipulate the database normally using special character?
– GiovaniOliveira
@Giovanioliveira The ideal would be to post in your question a minimum, complete and verifiable example (MVCE). That is, a complete code in Java and Postgresql settings that other people can copy and test to reproduce your problem and then search for solutions. However, this code would be minimal, that is, it would have only what would serve to demonstrate the problem and nothing more than that.
– Victor Stafusa
When you extract an MVCE code from the code of your program, you end up isolating the problem, which simplifies the search for the solution and allows other people to play it, and most of the time, you yourself end up finding the cause and the solution when trying to create the MVCE.
– Victor Stafusa
The problem is that I’m not doing anything too much, just giving a "statusDetalhe.getCodErro()", which in the bank is with accent but, in my application the message comes all messed up in place of accents. I have tried to display on the same console, without sending to JSP, with as little intervention as possible from Spring and still the problem occurs...
– GiovaniOliveira