Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

12
  • Does Converting text file to UTF-8 on Windows command prompt - Super User answer your question?
    – DavidPostill
    Commented May 29, 2023 at 17:49
  • Are you using the chcp command? Try chcp 437 (United States) to see if with it the program generates an ANSI file.
    – harrymc
    Commented May 29, 2023 at 17:49
  • @DavidPostill that result produces a UTF-8 BOM result which is not displayed properly and gives garbled cmd result. But thanks for the reply. "Set-Content" certainly looked different to "Out-File" which I demonstrated here, but it seems it does the same thing
    – bfh47
    Commented May 29, 2023 at 18:01
  • @harrymc I did briefly come across some solutions which used "chcp" however I didn't have luck using them, but from the sounds of it, maybe it deserves revisiting. Could you potentially provide a working example, or link one? I will do some research later today when I have time. if I run "chcp" it tells me I am using code page 866.
    – bfh47
    Commented May 29, 2023 at 18:06
  • Code page 866 is "DOS Cyrillic Russian", so there is no reason that it will generate UTF16. However, try putting the line chcp 437 before the command.
    – harrymc
    Commented May 29, 2023 at 18:09