Hi
How to read a file in UTF-8 and remove a BOM in batch script?
How to read a file in UTF-8 and remove a BOM in batch script?
-
- Posts: 8
- Joined: 2021-Sep-01, 10:57 am
- Simon Sheppard
- Posts: 127
- Joined: 2021-Jul-10, 7:46 pm
- Contact:
Re: How to read a file in UTF-8 and remove a BOM in batch script?
Some answers to this here
If you're using PowerShell [Core] version 6 or higher, you get BOM-less UTF-8 files by default
https://stackoverflow.com/questions/400 ... 4#40098904
PowerShell is much better suited to the task of dealing with encodings than batch:
To remove embedded UTF-8 BOM characters from source files: via SO
If you're using PowerShell [Core] version 6 or higher, you get BOM-less UTF-8 files by default
https://stackoverflow.com/questions/400 ... 4#40098904
PowerShell is much better suited to the task of dealing with encodings than batch:
To remove embedded UTF-8 BOM characters from source files:
Code: Select all
$files=get-childitem -Path . -Include @("*.h","*.cpp") -Recurse
foreach ($f in $files){
(Get-Content $f.PSPath) |
Foreach-Object {$_ -replace "\xEF\xBB\xBF", ""} |
Set-Content $f.PSPath
}