G
Guest
I am having a an issue trying to read a text file using the File.Read command.
Here's the code:
FileStream fs = File.Open ("somefile.xml",Open,Read,ReadWrite);
StringBuilder strXml = new StringBuilder();
byte[] b = new byte[1024];
UTF8Encoding temp = new UTF8Encoding(true);
while (fs.Read(b,0,b.Length) > 0)
{
strXml.Append(temp.GetString(b));
}
fs.Close();
The problem I'm having is when I look at the finished string
strXml.toString() it contains the cr / lf characters(\r\n) ie:
<COOKIES>\r\n <IDGROUP>somegroup</IDGROUP>\r\n
I do not want these non-printable characters, only the visual text.
I was hoping there is a setting I am missing.
Any help is greatly appreciated.
thanks
paul
Here's the code:
FileStream fs = File.Open ("somefile.xml",Open,Read,ReadWrite);
StringBuilder strXml = new StringBuilder();
byte[] b = new byte[1024];
UTF8Encoding temp = new UTF8Encoding(true);
while (fs.Read(b,0,b.Length) > 0)
{
strXml.Append(temp.GetString(b));
}
fs.Close();
The problem I'm having is when I look at the finished string
strXml.toString() it contains the cr / lf characters(\r\n) ie:
<COOKIES>\r\n <IDGROUP>somegroup</IDGROUP>\r\n
I do not want these non-printable characters, only the visual text.
I was hoping there is a setting I am missing.
Any help is greatly appreciated.
thanks
paul