4

I have 50 text files which need to be converted from utf-8 bom to ANSI. In Notepad++ We can do it with single file, but I want all opened files to be converted to ANSI in one short way. Is there any option there?

  • It seems that u need a way in command line to do it. Have you looked for a powershell solution? – chingNotCHing Dec 29 '16 at 11:11
  • i did not try., im not a power user or script writer. just looking for a tool that could do this job. any other way?. if it can be done in command line please let me know how to do it. – Abd Dec 29 '16 at 19:54
2

Suppose that your utf8bom files are in c:\temp\utf8\

I am saving the ansi files to c:\temp\ansi\

At command line,

> powershell
PS> get-item c:\temp\utf8\*.* | foreach-object {get-content $_ | out-file ("c:\temp\ansi\" + $_.Name) -encoding default}
PS> exit
>

What it does is that for each file in c:\temp\utf8, get its content and output to a file with the same filename in c:\temp\ansi with the Windows system default encoding, which is equivalent to ANSI you meant.

get-content command here can read the text without you specifying utf8 with or without bom.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.