Skip to content

Instantly share code, notes, and snippets.

@hiddenist
Last active August 29, 2015 14:01
Show Gist options
  • Save hiddenist/ebf633042ef32e049758 to your computer and use it in GitHub Desktop.
Save hiddenist/ebf633042ef32e049758 to your computer and use it in GitHub Desktop.
Function to detect and strip UTF-8 BOM from a string in ASP/VBScript
<%
Function stripBOM(ByVal content)
stripBOM = content
If Len(content) > 2 Then
If AscW(Mid(content, 1, 1)) = &HEF AND _
AscW(Mid(content, 2, 1)) = &HBB AND _
AscW(Mid(content, 3, 1)) = &HBF _
Then
stripBOM = Mid(content, 4)
End If
End If
End Function
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment