On Mar 20, 2:44 pm, Göran Andersson <g...@guffa.comwrote:
Aleks_Kl...@MailAPS.org wrote:
Yesterday after your email I thought that may be problem that I use
asp.net code and you visual basic.
What programming language are you using then? ASP.NET is not a
programming language, just a platform. I assumed that you were using
VB.NET as you are posting in the VB.NET newsgroup.
I repeat this code in visual basic
and got the same result (by the way I do not see spaces in your email,
at least they disapear in response windows; may be this server has the
same problem).
You are right, the spaces disappeared from the post. Each line in the
file was padded with spaces to eight characters in length.
Today I tried in VB next code
Dim HtmString As String
Dim TextStream As System.IO.StreamReader
Dim fso As Object, TextStream1 As Object
If (My.Computer.FileSystem.FileExists(fpath)) Then
TextStream = New System.IO.StreamReader(fpath, True)
'TextStream = System.IO.File.OpenText(fpath)
HtmString = System.IO.File.ReadAllText(fpath)
HtmString = TextStream.ReadToEnd()
TextStream.Close()
fso = CreateObject("Scripting.FileSystemObject")
TextStream1 = fso.OpenTextFile(fpath)
HtmString1 = TextStream1.ReadAll()
End If
HtmString and HtmString1 were different and HtmString1 has all spaces.
Aleks Kleyn
The equivalent of the FileSystemObject code would be:
HtmlString = System.IO.ReadAllText(path, System.Text.Encoding.ASCII)
--
Göran Andersson
_____http://www.guffa.com- Hide quoted text -
- Show quoted text -
i using visual basic.net. There is no difference where I use it: in
asp or desktop (the only difference that there is no global vars like
we use them in desktop). Today's test showed this one more time.
Spaces do not disappear for reason of posting because all code runs on
the server.
You probably mean System.IO.File.ReadAllText, because IO does not have
such method.
Adding your encoding turned disappeared spaces to question mark, so
they are not really spaces. The question now is to find good encoding,
but this is no problem. It is interesting, because file was prepared
by ms word.
Thank you very much