Spring boot JPA broken encoding on database when loaded from data.sql file

As covered in a previous article (here and here) spring-boot is a very useful framework when working on full enabled Spring projects

Recently I wasted some time with yet another encoding problem.. where all my accentuated and special characters where corrupted.

I was using the data.sql convention that states that if a file named data.sql is found in the CLASSPATH spring will use this file to bootstrap the database, my SQL file was properly encoded in UTF-8 as well as my maven-resources-plugin however the data recovered from the database was corrupted (accents and special characters where broken)

After reading a bit the documentation I found out that the source of the problem was at the moment of reading the SQL file that the encoding was causing trouble.. thankfully you can fix this one pretty easlily by changing one property value :

spring.datasource.sqlScriptEncoding=UTF-8

spring-boot has a lot of useful properties that allow you to tune the framework which you can find here

OSX paste unformatted text / remove text formatting

So recently I found about what is for me one of the best keyboard shortcuts on OSX often I copy text from somewhere and whenever I paste it...