output-file-encoding parameter

The output-file-encoding global parameter is a string that determines which character encoding to use when writing Liquibase command outputs to external files. By default, it is set to UTF-8.


If you need to send the output of a Liquibase command like generateChangeLog command,updateSQL command, or diff command to a text file that does not use UTF-8, you must specify the correct character encoding. This ensures that all symbols in your file display correctly.

Alternative or legacy character encodings include US-ASCII, Windows-1252, UTF-16, and others.

Setting the output-file-encoding parameter

You can set output-file-encoding in four ways:

  • As a JVM system property
  • In your liquibase.properties file
  • As a global parameter in the CLI
  • As an environment variable (Liquibase Pro)

Java system property

You can set output-file-encoding as a Java system property by using the JAVA_OPTS Environment Variable in your command line. The syntax on Mac/Linux is as follows:

JAVA_OPTS=-Dliquibase.outputFileEncoding=YOUR_ENCODING && liquibase update --changelog-file=dbchangelog.xml

The syntax on Windows requires the set command:

set JAVA_OPTS=-Dliquibase.outputFileEncoding=YOUR_ENCODING && liquibase update --changelog-file=dbchangelog.xml

liquibase.properties parameter

In Liquibase 4.1+, you can set output-file-encoding by adding the following to your liquibase.properties file:

liquibase.outputFileEncoding: YOUR_ENCODING

CLI global parameter

You can use output-file-encoding as a global parameter in your command line with a single Liquibase command, such as update:

liquibase --output-file-encoding=YOUR_ENCODING update --changelog-file=dbchangelog.xml

Environment variable (Liquibase Pro)

If you use Liquibase Pro, you can set output-file-encoding as an environment variable. The syntax on Mac/Linux is as follows:


The syntax on Windows requires the set command:


Note: The commands shown above only apply to the current shell. If you need to pass an environment variable to a child process without affecting the parent process, you can use the export command on Mac/Linux or the setx command on Windows.