2023年7月10日月曜日

MAGIC UTF8出力はBOM付きで出力される BOM無しにする方法

 

MAGIC UTF8出力はBOM付きで出力される。

BOM無しにするには Powershellを使用

 

'powershell -NoProfile -ExecutionPolicy Unrestricted -Command "& { $MyPath='&ASCIIChr(39)&Trim(BW)&ASCIIChr(39)&';$MyFile = Get-Content $MyPath; $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding($False);[System.IO.File]::WriteAllLines($MyPath, $MyFile, $Utf8NoBomEncoding)}"'

 

 

変数BWがファイル名(Full PATH)