For many purposes you can just do something like:
Code:Private Function GetUtf8AsUnicode(ByVal File As String) As String Dim BOM() As Byte Dim HasBOM As Boolean With New ADODB.Stream .Open .Type = adTypeBinary .LoadFromFile File BOM = .Read(3) HasBOM = BOM(0) = &HEF And BOM(1) = &HBB And BOM(2) = &HBF .Position = 0 .Type = adTypeText .Charset = "utf-8" If HasBOM Then .Position = 3 'Skip the BOM. GetUtf8AsUnicode = .ReadText(adReadAll) .Close End With End Function




Reply With Quote
