Use windows api to prevent encoding problems.