Can Notepad++ convert multiple opened files to ANSI (encoding)?

5

3

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?

Abd

Posted 2016-12-29T07:06:02.327

Reputation: 89

It seems that u need a way in command line to do it. Have you looked for a powershell solution? – chingNotCHing – 2016-12-29T11:11:06.467

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 – 2016-12-29T19:54:08.233

Answers

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.

chingNotCHing

Posted 2016-12-29T07:06:02.327

Reputation: 876