Load a file and then check its encoding

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
'Exit routine if import fails
exit sub
robopath.Visible =true
robopath.Text = f.NativePath
Roboempty = 0
'Read test sample
'Read block from file
'Check if block is empty
if s <> “” then
'Check encoding
Roboenc = Encoding(s)
end if
End If[/code]

Am i doing this correctly?