Enforcer rule char-set-encoding-rule has the following configuration parameters:
Validate files against this encoding, e.g. UTF-8.
Which dir to scan, often src.
Exclude files with names matching regex below, e.g. ^.*\.(gif|jpg|png)$.
Include files with names matching regex below, e.g. ^.*\.java$.