Explicitly use utf8 with stdout. Check for out=stdout earlier, inside createConfig(). Refactored switch statement.