0

When initializing postgreSQL database via application.properties using the data.sql -file, the inserted data with chars (like Ä and ö) that require utf-8 encoding do not get correctly encoded in their respective fields.

So, I have in the application.properties file the following by which to populate the database ...

spring.datasource.initialization-mode=always
spring.datasource.data=classpath:data.sql

...

Spring does the schema creation by:

spring.jpa.hibernate.ddl-auto=create-drop

What else should I define to get those chars to encode utf-8 correctly.

In addition, in pgAdmin properties I can see that the database itself is utf-8 encoded.

1 Answer 1

0

I found answer by finding it from an other thread: Wrong encoding between Spring and PostgreSQL.

This simply was needed in addition in application properties and utf-8 encoding now works:

spring.datasource.sql-script-encoding= UTF-8
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.