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?– chingNotCHingCommented Dec 29, 2016 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.– AbdCommented Dec 29, 2016 at 19:54
Add a comment
|
1 Answer
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.