View Single Post
  #6 (permalink)  
Old 12-20-2007, 04:50 PM
Erel's Avatar
Erel Erel is offline
Administrator
 
Join Date: Apr 2007
Posts: 3,132
Default

This is the code (it is also attached):
Code:
Sub Globals
    Dim buffer(0) As byte
End Sub

Sub App_Start
    RemoveBOM("1.csv","new2.csv") 
End Sub

Sub RemoveBOM(file,NewFile)
    FileOpen(c,file,cRandom)
    bin.New1(c,true)
    size = FileSize(file)-3
    Dim buffer(size) As byte
    bin.ReadBytes(buffer(),3) 'pass the BOM
    bin.ReadBytes(buffer(),size)
    FileClose(c)
    FileDel(NewFile)
    FileOpen(c2,NewFile,cRandom)
    bin.New1(c2,true)
    bin.WriteBytes(buffer())
    FileClose(c2)
End Sub
It creates a new file without the utf8 marking.
Attached Files
File Type: zip RemoveBOM.zip (3.1 KB, 13 views)
Reply With Quote