b4a 读取utf8 with bom

bom是微软的产物

Sub ReadUTF8FileMaybeWithBOM (Dir As String, Name As String) As String
  Dim s As String = File.ReadString(Dir, Name)
  If s.StartsWith(Chr(0xFEFF)) Then
    s = s.SubString(1)
  End If
Return s
End Sub
点赞