Posts

Showing posts from May, 2011

How to export data into UTF-8 without BOM in Visual Basic

Create stream for UTF-8. Set sqlStream = CreateObject("ADODB.Stream") 'Init stream sqlStream.Open sqlStream.Position = 0 sqlStream.Charset = "UTF-8" Write your data into the stream. Dim binaryStream As Object Set binaryStream = CreateObject("ADODB.Stream") binaryStream.Type = 1 binaryStream.Mode = 3 binaryStream.Open 'Skip BOM bytes sqlStream.Position = 3 sqlStream.CopyTo binaryStream sqlStream.Flush sqlStream.Close binaryStream.SaveToFile sqlFilename, 2 binaryStream.Close