Add the possibility to set defaultCharsetName

Can you help solve the following issue:

At our projects we use sql changelogs. These sql files are in utf-8, without BOM. Our Windows machines have cp-1251 encoding.
And as the result we have wrong characters for Russian letters in the DB after Liquibase runs scripts.

As far as I understand, Liquibase determines the encoding/charset of an sql changelog by the BOM in that file.
If there is no BOM - it uses system default encoding.
Code: : this.defaultCharsetName = Charset.defaultCharset().name();

I suggest to add the possibility to set defaultCharsetName somewhere. Possibly in xml changelog:

And this property should be applied to all the changelogs, these changelog includes (<include …>).

The other solution I see - adding BOM to our source files - is inconvenient for us.

P.S. I haven’t found how to create this issue at the jira (, though, I’ve signed up there.

What version of liquibase are you using? There have been some improvements to UTF support through 3.1.1 that may help.

If you have created a user on liquibase.jira com, there should be a blue “Create Issue” button int he middle of the header bar.


Someone else said they can’t see where to create an issue either. I’m looking into that…


Separate testing shows the button there. Perhaps a temporary jira bug that is resolved?


Nathan, thanks for the reply !

I’m using 3.1.1.
Yes, there were improvements.
Checksums now are calculated the same across Win and Linux. The calculation uses UtfBomStripperInputStream instead of UtfBomAwareReader.

But, when executing sql script, UtfBomAwareReader is used as before.
This leads to wrong characters in the DB.

I’ve experimented with 3.1.1 by replacing in UtfBomAwareReader
code: this.defaultCharsetName = Charset.defaultCharset().name();
with: this.defaultCharsetName = ‘UTF-8’;

And it works like a charm.
So, I suppose that the issue is still present.

Thanks, I created to track the change. I’ll try it out and see if there are other chagnes that need to be made as well.