utf8 in a SQL tag encoding properly

When I use the with a insert statement that contains UTF8, the data is not encoded properly when it gets into the database.  I don’t see any encoding attribute on or , so I would assume its using the <?xml encoding>

  is working fine.

Is there a way to make this work, or do I have to use the loadData?


<?xml version="1.0" encoding="UTF-8" standalone="no"?>

            Insert into language (id_language,name) values (2,‘中文 (Chinese)’);


It should use the encoding of the XML file, although I’ve heard some issues with it. What liquibase version are you using? There have been some improvements in later 3.0.x releases. 


I was using 3.0.6, and have since upgrade to 3.0.7 and still have the issue

I just tested putting it into a .sql file and including that file, and it has the same issue.

I am running liquibase from within an application. I went looking to see if there was a setting somewhere, and found that the UtfBomAwareReader is using Charset.defaultCharset().  it has a constructor that will accept a charset, but that’s only used from the CSVReader and SQLChangeLog

I was able to add -Dfile.encoding=UTF-8 to my command line arguments and it resolved the issue.  But this is not ideal for us.  I would be better If I could set a setting within the code, maybe something on the ResourceAccessor, or just a static variable that could be checked before using Charset.defaultCharset().