> hello... i've a little problem here... n00b question -))
so if you can help me...
the "output" string bellow, comes in UNICODE, but i want to get it on
windows-1251 (cytillic)
how can i do this?..
webResponse = (HttpWebResponse)webRequest.GetResponse();
Stream streamResponse = webResponse.GetResponseStream();
StreamReader streamRead = new StreamReader(streamResponse);
output = streamRead.ReadToEnd();
Hi David,
After obtaining the output string you can convert it to the encoding of your
choice by using Encoding.Convert available under System.Text namespace.
Please check the following code snippet:
<CODE>
string str = "UTF8 Encoded string.";
Encoding srcEncodingFormat = Encoding.UTF8;
Encoding dstEncodingFormat = Encoding.GetEncoding("windows-1251");
byte [] originalByteString = srcEncodingFormat.GetBytes(str);
byte [] convertedByteString = Encoding.Convert(srcEncodingFormat,
dstEncodingFormat, originalByteString);
string finalString = dstEncodingFormat.GetString(convertedByteString);
</CODE>
Hope it will help.
--
Cheers,
Rahul Anand