Fix encoding error on Windows

Related to https://projects.puppetlabs.com/issues/21285