|
-
May 28th, 2008, 09:44 AM
#1
Stream Reader/Writer Encoding
Hello all,
I am having a problem while setting encoding for stream/writer reader using c#.
I have to download text files using ftp and http requets.
The problem is that i dont know the encoding of text files.
i am using code below.
Stream readStream = new MemoryStream();
readStream= FTPwebResponse.GetResponseStream();
or
readStream = HTTPwebResponse.GetResponseStream();
then i will read it through stream reader
StreamReader reader = new StreamReader(readStream, Encoding.?????);
String responce = reader.ReadToEnd();
StreamWriter writeStream = new StreamWriter(FileNameWithPath, true, Encoding.????????);
writeStream.Write(responce);
here i dont know which encoding to use. if i dont use encoding i am getting sone unknown characters in some files. that are italian, spanish, arabic etc. some of these are comming fine but in some places i am getting boxes and question marks.
is there any way to detect encoding of stream ? so that i can use it for in stream reader/writer??
hope some one will help me out.
thanks in advance.
Best Regards,
Mansoor.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|