Load a file and then check its encoding

Hello!
I am doing a simple file load but i wanted to make it safe to load files in both ansi and unicode

This is the code i wrote to load a file and attempt to scan its encoding

[code] Dim tests As Int32
Dim s as string
Dim f as folderitem
Dim bs as binarystream
Dim roboenc as textencoding
Dim robopath as string

'Select input file
f = GetOpenFolderItem(FileTypes1.ALL)
'Cancel button clicked
if f=nil then
'Notify user
MsgBox(Fileerror)
'Exit routine if import fails
exit sub
Else
robopath.Visible =true
robopath.Text = f.NativePath
Roboempty = 0
'Read test sample
bs=BinaryStream.Open(f)
'Read block from file
s=bs.Read(600)
'Check if block is empty
if s <> “” then
'Check encoding
Roboenc = Encoding(s)
end if
bs.close
End If[/code]

Am i doing this correctly?