' If the stream is not set yet If oStreamWriter Is Nothing Then ' If we cannot get the encoding loFileFunction.cFile = cFile If Not loFileFunction.GetEncoding() Then End If oStreamWriter = New StreamWriter(oFileStream, loFileFunction.cEncoding) End If loFile = New IO.StreamReader(cFile) oStreamWriter.Write(loFile.ReadToEnd()) loFile.Close() nLength = oStreamWriter.BaseStream.LengthBasically, I call loFileFunction.GetEncoding() to obtain the encoding of the file. It is ANSI. So, oStreamWriter can create the stream with the proper encoding. I verified that. The file is in fact created with ANSI encoding.