govind

govind

  • NA
  • 1
  • 0

response stream is showing garbage character

Oct 8 2007 12:40 PM

We are connecting with web services and getting response from remote server. We are saving the response in Stream Reader but whenever we bind this stream in any server control or get any doc file from the responses. It is not showing in proper format, or in other words showing some garbage characters.

We have also try unicode character system.text.encode.unicode, utf-8,utf-16 or other format.

we have used this code

   StreamReader readStream = new StreamReader(stream);
         
            const int stride = 5000000;
            Char[] read = new Char[stride];

            int count = readStream.Read(read, 0, stride);
            StringBuilder data = new StringBuilder();
            while (count > 0)
            {
                string str = new string(read, 0, count);
                data.Append(str.ToString().TrimStart().TrimEnd());
                count = readStream.Read(read, 0, stride);

But charecters are not in readable format.

Please help would appreciate

Govind