Created
February 24, 2012 09:45
-
-
Save koma5/1899792 to your computer and use it in GitHub Desktop.
this script removes the UTF-8 BOM "" 0xEFBBBF from the beginning of a file / just drag and drop a file on this script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Const UTF8_BOM = "" | |
Const ForReading = 1 | |
Const ForWriting = 2 | |
Dim fso | |
Set fso = WScript.CreateObject("Scripting.FileSystemObject") | |
Dim f | |
f = WScript.Arguments.Item(0) | |
Dim t | |
t = fso.OpenTextFile(f, ForReading).ReadAll | |
If Left(t, 3) = UTF8_BOM Then | |
fso.OpenTextFile(f, ForWriting).Write (Mid(t, 4)) | |
MsgBox "BOM deleted!" | |
Else | |
MsgBox "UTF-8-BOM not found!" | |
End If |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment